Method and device for entropy coding/decoding

ABSTRACT

The present invention relates to an entropy decoding method which includes: generating context related to a bin that forms a codeword of a syntax element; and performing arithmetic decoding of the bin based on the context.

TECHNICAL FIELD

The present invention relates to A video processing technique, and moreparticularly, to an entropy encoding/decoding method and a device usingthe same.

BACKGROUND ART

Recently, demands for a high-resolution and high-quality video such as ahigh definition (HD) video and an ultra high definition (UHD) video haveincreased in various fields of applications. As a video has higherresolution and higher quality, an amount of information or an amount ofbits to be transmitted increases more and more relatively to existingvideos. Accordingly, when video information is transferred using mediasuch as existing wired or wireless broadband lines or video informationis stored in existing storage media, the information transfer cost andthe information storage cost increase. High-efficiency video compressingtechniques can be used to solve these problems.

Various techniques such as an inter prediction technique of predictingpixel values of a current picture with reference to pictures previousand/or subsequent to the current picture, an intra prediction techniqueof predicting pixel values of a current picture using pixel informationin the current picture, and an entropy coding technique of allocating ashort code to a value of a low appearance frequency and allocating along code of a value of a high appearance frequency are known as thevideo compressing techniques. It is possible to effectively compress,transfer, or store video data using such video compressing techniques.

SUMMARY OF THE INVENTION Technical Problem

An object of the invention is to provide video encoding method anddevice that can enhance video encoding/decoding efficiency and reducecomplexity.

Another object of the invention is to provide a video decoding methodand a video decoder which can improve video encoding/decoding efficiencyand reduce complexity.

Still another object of the invention is to provide entropy encodingmethod and device which can improve video encoding/decoding efficiencyand reduce complexity.

Still another object of the invention is to provide entropy decodingmethod and device which can improve video encoding/decoding efficiencyand reduce complexity.

Solution to Problem

According to an aspect of the invention, there is provided an entropydecoding method. The entropy decoding method including the steps of:deriving a context for a bin constituting a codeword of a syntaxelement; and performing an arithmetic decoding operation on the bin onthe basis of the derived context. Here, the step of deriving the contextmay include deriving the context on the basis of at least one ofinformation on a size of a transform block to which the syntax elementis applied and information on a partition depth of the transform block.

The context may be indicated by the sum of a context index offsetdetermined on the basis of a slice type of a current slice and a contextindex by the bin.

The syntax element may be a luma coded block flag indicating whetherluma components of the transform block include one or more coefficientsother than 0, the bin may be a first bin of the codeword to which a binindex value of 0 is allocated, and the context index may be derived onthe basis of a context table to which the context index by the bin isallocated.

When the partition depth of the transform block is 0, a context index of1 may be allocated to the bin.

When the partition depth of the transform block is not 0, a contextindex of 1 may be allocated to the bin when the size of the transformblock is equal to a maximum transform size of a current sequence, and acontext index of 0 may be allocated to the bin when the size of thetransform block is not equal to the maximum transform size.

The context index allocated to the bin may be determined depending onthe partition depth of the transform block without depending on the sizeof the transform block.

When the partition depth of the transform block is not 0, a contextindex of 0 may be allocated to the bin without depending on whether thesize of the transform block is equal to the maximum transform size ofthe current sequence.

The value of the context index offset may be 0 when the current slice isan I slice, may be 2 when the current slice is a P slice, and may be 4when the current slice is a B slice.

The syntax element may be a chroma coded block flag indicating whetherchroma components of the transform block include one or morecoefficients other than 0, the bin may be a first bin of the codeword towhich a bin index value of 0 is allocated, and the context index may bederived on the basis of a context table to which the context index bythe bin is allocated.

The value of the partition depth of the transform block may be allocatedas the context index by the bin.

The value of the context index offset may be 0 when the current slice isan I slice, may be 2 when the current slice is a P slice, and may be 4when the current slice is a B slice.

According to another aspect of the invention, there is provided a videodecoding method. The video decoding method includes the steps of:deriving a context for a bin constituting a codeword of a syntaxelement; acquiring information on the syntax element by performing anarithmetic decoding operation on the bin on the basis of the derivedcontext; and reconstructing a video on the basis of the information onthe syntax element. Here, the step of deriving the context may includederiving the context on the basis of at least one of information on asize of a transform block to which the syntax element is applied andinformation on a partition depth of the transform block.

According to still another aspect of the invention, there is provided avideo decoder. The video decoder includes: an entropy decoding modulethat derives a context for a bin constituting a codeword of a syntaxelement that acquires information on the syntax element by performing anarithmetic decoding operation on the bin on the basis of the derivedcontext; and a video reconstructing module that reconstructs a video onthe basis of the information on the syntax element. Here, the entropydecoding module may derive the context on the basis of at least one ofinformation on a size of a transform block to which the syntax elementis applied and information on a partition depth of the transform block.

The context may be indicated by the sum of a context index offsetdetermined on the basis of a slice type of a current slice and a contextindex by the bin.

The syntax element may be a luma coded block flag indicating whetherluma components of the transform block include one or more coefficientsother than 0, the bin may be a first bin of the codeword to which a binindex value of 0 is allocated, and the entropy decoding module maydetermine the context index on the basis of a context table to which thecontext index by the bin is allocated.

The entropy decoding module may allocate a context index of 1 to the binwhen the partition depth of the transform block is 0.

The entropy decoding module may allocate a context index of 1 to the binwhen the partition depth of the transform block is not 0 and the size ofthe transform block is equal to a maximum transform size of a currentsequence, and the entropy decoding module may allocate a context indexof 0 to the bin when the size of the transform block is not equal to themaximum transform size.

The entropy decoding module may determine the context index allocated tothe bin depending on the partition depth of the transform block withoutdepending on the size of the transform block.

The entropy decoding module may allocate a context index of 0 to thebin, without depending on whether the size of the transform block isequal to the maximum transform size of the current sequence, when thepartition depth of the transform block is not 0.

The value of the context index offset may be 0 when the current slice isan I slice, may be 2 when the current slice is a P slice, and may be 4when the current slice is a B slice.

Advantageous Effects

According to the video encoding method of the invention, it is possibleto enhance video encoding/decoding efficiency and to reduce complexity.

According to the video decoding method of the invention, it is possibleto enhance video encoding/decoding efficiency and to reduce complexity.

According to the entropy encoding method of the invention, it ispossible to enhance video encoding/decoding efficiency and to reducecomplexity.

According to the entropy decoding method of the invention, it ispossible to enhance video encoding/decoding efficiency and to reducecomplexity.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram schematically illustrating a video encoderaccording to an embodiment of the invention.

FIG. 2 is a block diagram schematically illustrating a video decoderaccording to an embodiment of the invention.

FIG. 3 is a diagram schematically illustrating an example of a quad treestructure of process units in a system to which the invention isapplied.

FIG. 4 is a block diagram schematically illustrating an example of aconfiguration of an entropy encoding module according to the invention.

FIG. 5 is a block diagram schematically illustrating an example of aconfiguration of an entropy decoding module according to the invention.

FIG. 6 is a flowchart schematically illustrating an example of anentropy decoding process according to the invention.

FIG. 7 is a flowchart schematically illustrating an example of anentropy decoding process when a regular decoding engine is used.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

The present invention may be variously modified in various forms and mayhave various embodiments, and specific embodiments thereof will beillustrated in the drawings and described in detail. However, theseembodiments are not intended for limiting the invention. Terms used inthe below description are used to merely describe specific embodiments,but are not intended for limiting the technical spirit of the invention.An expression of a singular number includes an expression of a pluralnumber, so long as it is clearly read differently. Terms such as“include” and “have” in this description are intended for indicatingthat features, numbers, steps, operations, elements, components, orcombinations thereof used in the below description exist, and it shouldbe thus understood that the possibility of existence or addition of oneor more different features, numbers, steps, operations, elements,components, or combinations thereof is not excluded.

On the other hand, elements of the drawings described in the inventionare independently drawn for the purpose of convenience of explanation ondifferent specific functions in an image encoder and an image decoder,and do not mean that the elements are embodied by independent hardwareor independent software. For example, two or more elements out of theelements may be combined to form a single element, or one element may bepartition into plural elements. Embodiments in which the elements arecombined and/or partition belong to the scope of the invention withoutdeparting from the concept of the invention.

Hereinafter, exemplary embodiments of the invention will be described indetail with reference to the accompanying drawings. The same elements inthe drawings will be referenced by the same reference signs and thedescription of the same elements will not be repeated.

FIG. 1 is a block diagram schematically illustrating a video encoderaccording to an embodiment of the invention. Referring to FIG. 1, avideo encoder 100 includes a picture partitioning module 105, aprediction module 110, a transform module 115, a quantization module120, a rearrangement module 125, an entropy encoding module 130, adequantization module 135, an inverse transform module 140, a filtermodule 145, and a memory 150.

The picture partitioning module 105 may partition an input picture intoat least one process unit block. Here, a block as the process unit maybe a prediction unit (hereinafter, referred to as a “PU”), a transformunit (hereinafter, referred to as a “TU”), or a coding unit(hereinafter, referred to as a “CU”).

The prediction module 110 includes an inter prediction module thatperforms an inter prediction operation and an intra prediction modulethat performs an intra prediction operation. In order to enhanceencoding efficiency, the video encoder may predict a picture using apreviously-encoded region and may encode residual values between anoriginal picture and the predicted picture.

The prediction module 110 may perform a prediction operation on theprocess unit of a picture partition by the picture partitioning module105 to construct a predicted block. The process unit of a picture in theprediction module 110 may be a CU, a TU, or a PU. The prediction module110 may determine whether the prediction operation performed on thecorresponding process unit is an inter prediction operation or an intraprediction operation, and may determine specific details (for example, aprediction mode) of the prediction methods may be determined. Theprocess unit subjected to the prediction operation may be different fromthe process unit of which the prediction method and the specific detailsare determined. For example, the prediction method and the predictionmode may be determined in the units of CU or PU and the predictionoperation may be performed in the units of TU.

In the inter prediction, a prediction operation may be performed on thebasis of information on at least one of a previous picture and/or asubsequent picture of a current picture to construct a predicted block.In the intra prediction, a prediction operation may be performed on thebasis of pixel information of a current picture to construct a predictedblock.

A skip mode, a merge mode, a motion vector prediction (MVP), or the likemay be used as the intra prediction method. In the inter prediction, areference picture may be selected for a PU, and a reference block havingthe same size as the PU may be selected. The reference block may beselected in the unit of integer pixels. A predicted block may beconstructed so that a residual signal from a current PU is minimized andthe magnitude of a motion vector is minimized.

The predicted block may be constructed in the unit of integer pixelsamples or in the unit of pixel samples less than an integer pixel, suchas ½ pixel samples and ¼ pixel samples. Here, a motion vector may alsobe expressed in the unit of pixel samples less than an integer pixel.For example, luma pixels may be expressed in the unit of ¼ pixels andchroma pixels may be expressed in the unit of ⅛ pixels.

Information such as an index of a reference picture selected through theinter prediction, a motion vector (for example, a motion vectorpredictor), and a residual signal may be entropy-encoded and transmittedto a video decoder. When the skip mode is used, the predicted block maybe used as a reconstructed block and thus the residual signal may not becreated, converted, quantized, and transmitted.

When the intra prediction is performed, a prediction mode may bedetermined in the unit of PUs and the prediction operation may beperformed in the unit of PUs. Alternatively, a prediction mode may bedetermined in the unit of PUs and the intra prediction may be performedin the unit of TUs.

In the intra prediction, the prediction module 110 may determine anintra prediction mode of a PU and may perform a prediction operation onthe basis of the determined intra prediction mode. The prediction modesin the intra prediction may include 33 directional prediction modes andat least two non-directional modes. The non-directional modes mayinclude a DC prediction mode and a planar mode.

In the intra prediction, a predicted block may be constructed after afilter is applied to reference samples. At this time, it may bedetermined whether a filter should be applied to reference samples,depending on the intra prediction mode of a current block and/or thesize of the current block.

Information on the intra prediction mode selected through the intraprediction may be entropy-encoded and transmitted to the video decoder.

A PU may be a block having various sizes/shapes. For example, in case ofthe inter prediction, a PU may be a 2N×2N block, a 2N×N block, a N×2Nblock, or a N×N block (where N is an integer). In case of the intraprediction, a PU may be a 2N×2N block or a N×N block (where N is aninteger). The PU having a block size of N×N may be set to be used inonly a specific case. For example, the PU having a block size of N×N maybe set to be used for only a CU having the smallest size or may be setto be used for only the intra prediction. In addition to theabove-mentioned sizes, PUs such as a N×mN block, a mN×N block, a 2N×mNblock, and a mN×2N block (where m<1) may be additionally defined andused.

Residual values (a residual block or a residual signal) between theconstructed predicted block and the original block may be input to thetransform module 115. The prediction mode information, the motion vectorinformation, and the like used for the prediction may be encoded alongwith the residual values by the entropy encoding module 130 and may betransmitted to the video decoder.

The transform module 115 may perform a transform operation on theresidual block by transform units and created transform coefficients.The transform unit in the transform module 115 may be a TU and may havea quad tree structure. The size of the transform unit may be determinedwithin a predetermined range of largest and smallest sizes. Thetransform module 115 may transform the residual block using a discretecosine transform (DCT) and/or a discrete sine transform (DST).

The quantization module 120 may quantize the residual values transformedby the transform module 115 and may create quantization coefficients.The values calculated by the quantization module 120 may be supplied tothe dequantization module 135 and the rearrangement module 125.

The rearrangement module 125 may rearrange the quantization coefficientssupplied from the quantization module 120. By rearranging thequantization coefficients, it is possible to enhance the codingefficiency in the entropy encoding module 130. The rearrangement module125 may rearrange the quantization coefficients in the form of atwo-dimensional block to the form of a one-dimensional vector throughthe use of a coefficient scanning method. The rearrangement module 125may enhance the entropy encoding efficiency in the entropy encodingmodule 130 by changing the coefficient scanning order on the basis ofstochastic statistics of the coefficients transmitted from thequantization module.

The entropy encoding module 130 may perform an entropy encodingoperation on the quantization coefficients rearranged by therearrangement module 125. Examples of the entropy encoding methodinclude an exponential Golomb method, a CAVLC (Context-Adaptive VariableLength Coding) method, and a CABAC (Context-Adaptive Binary ArithmeticCoding) method. The entropy encoding module 130 may encode a variety ofinformation such as quantization coefficient information and block typeinformation of a CU, prediction mode information, partition unitinformation, PU information, transfer unit information, motion vectorinformation, reference picture information, block interpolationinformation, and filtering information transmitted from therearrangement module 125 and the prediction module 110.

The entropy encoding module 130 may give a predetermined change to aparameter set or syntaxes to be transmitted, if necessary.

The entropy encoding module 130 may create consecutive codewords on thebasis of input symbols. Here, the length of a codeword may be variable.For example, when the entropy encoding is performed, a low index valueand a short codeword corresponding thereto may be allocated to a symbolof a high appearance frequency and a high index value and a longcodeword corresponding thereto may be allocated to a symbol of a lowappearance frequency. Therefore, it is possible to reduce an amount ofbits for symbols to be encoded and to improve video compressionperformance by the entropy encoding.

The dequantization module 135 dequantizes the values quantized by thequantization module 120. The inverse transform module 140 inverselytransforms the values dequantized by the dequantization module 135. Theresidual values created by the dequantization module 135 and the inversetransform module 140 may be merged with the predicted block predicted bythe prediction module 110 to construct a reconstructed block.

FIG. 1 illustrates that the residual block and the predicted block areadded by an adder to construct a reconstructed block. Here, the addermay be considered as a particular module (reconstructed blockconstructing module) that constructs a reconstructed block.

The filter module 145 may apply a deblocking filter, a sample adaptiveoffset (SAO), and/or an adaptive loop filter (ALF) to the reconstructedpicture.

The deblocking filter may remove a block distortion generated at theboundary between blocks in the reconstructed picture. The SAO mayreconstruct an offset difference of the residual block, which has beensubjected to the deblocking filter, from the original video in the unitof pixels and may be applied in the form of a band offset and an edgeoffset. The ALF may perform a filtering operation on the basis of theresultant values of comparison of the original picture with thereconstructed picture of which the blocks have been filtered by thedeblocking filter and/or the SAO. The ALF may be applied only when highefficiency is necessary.

On the other hand, the filter module 145 may not perform a filteringoperation on the reconstructed block used in the inter prediction.

The memory 150 may store the reconstructed block or picture calculatedby the filter module 145. The reconstructed block or picture stored inthe memory 150 may be supplied to the prediction module 110 thatperforms the inter prediction.

FIG. 2 is a block diagram schematically illustrating a video decoderaccording to an embodiment of the invention. Referring to FIG. 2, avideo decoder 200 may include an entropy decoding module 210, arearrangement module 215, a dequantization module 220, an inversetransform module 225, a prediction module 230, a filter module 235, anda memory 240.

When a video bitstream is input from the video encoder, the inputbitstream may be decoded on the basis of the order in which videoinformation is processed by the video encoder.

For example, when the video encoder uses a variable length coding(hereinafter, referred to as “VLC”) method such as the CAVLC method toperform the entropy encoding operation, the entropy decoding module 210may implement the same VLC table as the VLC table used in the videoencoder and may perform the entropy decoding operation. When the videoencoder uses the CABAC method to perform the entropy encoding process,the entropy decoding module 210 may perform the entropy decodingoperation using the CABAC method to correspond thereto.

Information for constructing a predicted block out of the informationdecoded by the entropy decoding module 210 may be supplied to theprediction module 230, and the residual values entropy-decoded by theentropy decoding module 210 may be input to the rearrangement module215.

The rearrangement module 215 may rearrange the bitstream entropy-decodedby the entropy decoding module 210 on the basis of the rearrangementmethod in the video encoder. The rearrangement module 215 mayreconstruct and rearrange coefficients expressed in the form of aone-dimensional vector into coefficients in the form of atwo-dimensional block. The rearrangement module 215 may be supplied withinformation associated with the coefficient scanning performed by thevideo encoder and may perform the rearrangement using a method ofinversely scanning the coefficients on the basis of the scanning orderin which the scanning is performed by the video encoder.

The dequantization module 220 may perform dequantization on the basis ofthe quantization parameters supplied from the video encoder and thecoefficient values of the rearranged block.

The inverse transform module 225 may perform the inverse DCT and/orinverse DST of the DCT and/or DST, which has been performed by thetransform module of the video encoder, on the quantization result fromthe video encoder. The inverse transform may be performed on the basisof a transfer unit or a partition unit of a picture determined by thevideo encoder. The transform module of the video encoder may selectivelyperform the DCT and/or DST depending on plural information pieces suchas the prediction method, the size of a current block, and theprediction direction, and the inverse transform module 225 of the videodecoder may perform the inverse transform on the basis of the transforminformation on the transform performed by the transform module of thevideo encoder.

The prediction module 230 may construct a predicted block on the basisof prediction block construction information supplied from the entropydecoding module 210 and the previously-decoded block and/or pictureinformation supplied from the memory 240. The specific prediction methodperformed by the prediction module 230 may be the same as the predictionmethod performed by the prediction module of the video encoder.

When the prediction mode of a current CU and/or PU is an intraprediction mode, the prediction module 230 may perform an intraprediction operation of constructing a predicted block on the basis ofpixel information of a current picture. At this time, the predictionmodule 230 may determine an intra prediction mode of the PU and mayperform the prediction operation on the basis of the determined intraprediction mode. Here, when intra prediction mode-relevant informationreceived from the video encoder is confirmed, the intra prediction modemay be induced to correspond to the intra prediction mode-relevantinformation.

When the prediction mode for a current CU and/or PU is the interprediction mode, the prediction module 230 may perform the interprediction operation on the current PU on the basis of informationincluded in at least one of a previous picture and a subsequent pictureof the current picture. At this time, motion information for the interprediction of the current PU, for example, information on motion vectorsand reference picture indices, supplied from the video encoder may beinduced from a skip flag, a merge flag, and the like received from thevideo encoder.

The reconstructed block may be constructed using the predicted blockconstructed by the prediction module 230 and the residual block suppliedfrom the inverse transform module 225. FIG. 2 illustrates that theresidual block and the predicted block are added by an adder toconstruct a reconstructed block. Here, the adder may be considered as aparticular module (reconstructed block constructing module) thatconstructs a reconstructed block.

When the skip mode is used, the residual signal may not be transmittedand the predicted block may be used as a reconstructed block.

The reconstructed block and/or picture may be supplied to the filtermodule 235. The filter module 235 may perform a deblocking filteringoperation, an SAO operation, and/or an ALF operation on thereconstructed block and/or picture.

The memory 240 may store the reconstructed picture or block for use as areference picture or a reference block and may supply the reconstructedpicture to an output module.

Although not illustrated herein for the purpose of convenience ofexplanation, a bitstream input to the video decoder may be input to theentropy decoding module 210 after being subjected to a parsing process.The entropy decoding module 210 may perform the parsing process.

On the other hand, in FIG. 2, the rearrangement module 215, thedequantization module 220, the inverse transform module 225, theprediction module 230, the filter module 235, and the memory 240 areillustrated as individual modules, but these modules may be incorporatedinto a single module. For example, the rearrangement module 215, thedequantization module 220, the inverse transform module 225, theprediction module 230, the filter module 235, and the memory 240 may beconsidered as a single “video decoding module”. Here, the video decodingmodule may reconstruct a video through the above-mentioned processes onthe basis of the information decoded by the entropy decoding module 210.

A video signal processed by the video encoder and the video decoder mayinclude three color signals representing magnitudes of three primarycolor components. The three color signals may be indicated by R (Red), G(Green), and B (Blue). In order to reduce the frequency bands used forthe video processing, the R, G, and B signals may be converted into lumaand chroma signals which are equivalent to the R, G, and B signals.Here, a video signal may include one luma signal and two chroma signals.The luma signal is a component representing the brightness of a screenand the chroma signal is a component representing the color of thescreen. For example, the chroma signal may represent a differencebetween predetermined colors. The luma signal may be indicated by “L” or“luma” and the two chroma signals may be indicated by “Cb” and “Cr”.Since the human eye is sensitive to the luma signal and is insensitiveto the chroma signals, the number of pixels of the chroma component in apicture or a block may be smaller than the number of pixels of the lumacomponent.

In the invention, “coding” may be analyzed to be encoding and/ordecoding depending on circumstances. “Information” may be understood asa term including all of values, parameters, coefficients, and elements.

“Screen” or “picture” generally means a unit representing an image of aspecific time zone. “Slice” and “frame” may mean a unit constituting apart of a picture in actual video coding. The terms, “slice” and“frame”, may be mixed with each other case by case.

In the below description, a current block may be a block which iscurrently subjected to encoding, decoding, and/or prediction operationsand may be a block corresponding to a process unit when the encoding,decoding, and/or prediction operations are performed. For example, whena prediction operation is performed on a current block, the currentblock may be a prediction target block corresponding to a currentprediction unit. In the below description, a block constructed throughthe prediction is referred to as a predicted block.

A “unit” means a basic unit for processing a picture or a specificposition in a picture, such as a coding unit (CU), a prediction unit(PU), and a transform unit (TU) and may be distinguished from a “block”indicating a set of pixels and/or samples. In the below description, forthe purpose of convenience of explanation, a “unit” may mean a “block”corresponding to the “unit”. For example, in the below description, aprediction target block corresponding to one prediction unit may bereferred to as a prediction unit and/or a prediction block, anencoding/decoding target block corresponding to one coding unit may bereferred to as a coding unit and/or a coding block. A block may be usedas a term expressing a set of pixels or transform coefficients includingM (where M is a natural number) columns and N (where N is a naturalnumber) rows. This distinction will be apparent to those skilled in theart.

On the other hand, slices used in the video encoding process and thevideo decoding process in FIGS. 1 and 2 may be classified into an Islice, a P slice, and a B slice. The I slice is a slice which isencoded/decoded in only the intra prediction. Temporal prediction is notapplied to the I slice and only intra information can be used for theprediction process. The P slice is a slice which can be encoded/decodedthrough the inter prediction or the intra prediction using at least onemotion vector and a reference picture index to predict pixel values ofblocks. The B slice is a slice which can be encoded/decoded through theinter prediction or the intra prediction using at least two motionvectors and reference picture indices to predict pixel values of blocks.

In an inter prediction mode, the video encoder illustrated in FIG. 1 orthe video decoder illustrated in FIG. 2 may derive motion information ofa current block and may perform the inter prediction on the currentblock on the basis of the derived motion information.

A picture used to predict a current block may be referred to as areference picture or a reference frame. An area in a reference picturemay be expressed by a reference picture index indicating the referencepicture and a motor vector.

A reference picture list for a current picture and/or a current slicemay be constructed by pictures used for prediction, and a referencepicture index indicates a specific reference picture in the referencepicture list. The P slice requires a single reference picture list suchas reference picture list 0, and the B slice requires two referencepicture lists such as reference picture list 0 and reference picturelist 1.

For example, a P slice can be encoded/decoded by unidirectionalprediction using one reference picture. Here, a P slice requires onereference picture list, which is called reference picture list 0 (L0).

A B slice can be encoded/decoded by forward, backward, or bi-directionalprediction, for example, using two reference pictures. The B slicerequires two reference picture lists, which are called reference picturelist 0 (L0) and reference picture list 1 (L1).

The inter prediction using a reference picture selected from L0 iscalled L0 prediction. The L0 prediction is used mainly for forwardprediction. The inter prediction using a reference picture selected fromL1 is called L1 prediction. The L1 prediction is used mainly forbackward prediction. The L0 prediction and the L1 prediction arerespectively called uni-prediction. The inter prediction using tworeference pictures selected from L0 and L1 is called bi-prediction.

The inter prediction mode applied to a current block (for example, PU)out of the L0 prediction, the L1 prediction, and the bi-prediction maybe indicated by a syntax element of “inter_pred_idc” in a system. Here,inter_pred_idc may indicate the inter prediction direction of thecurrent block. When the prediction mode of the current block is an intermode, information on to which inter prediction mode out of the L0prediction, the L1 prediction, and the bi-prediction the prediction modeof the current block corresponds may be transmitted from the videoencoder to the video decoder through the use of inter_pred_idc.

When the inter prediction modes are reduced to two types of thebi-prediction mode and the uni-prediction mode, the index of“inter_pred_idc” may be replaced with a flag such as “inter_pred_flag”.In this case, LC prediction collectively expressing the L0 predictionand the L1 prediction may be used. The LC prediction means interprediction using a reference picture selected from a combined list ofreference picture list 0 and reference picture list 1. Here,inter_pred_flag may indicate one of the LC prediction and thebi-prediction.

FIG. 3 is a diagram schematically illustrating an example of a quad treestructure of process units in a system to which the present invention isapplied.

A coding unit (CU) may mean a unit of a picture subjected toencoding/decoding. One coding block in a coding target picture may havea depth based on a quad tree structure and may be repeatedlypartitioned. A coding block which is not partitioned any more may be thecoding unit, and the video encoder may perform an encoding operation onthe coding unit.

Here, a coding block repeatedly partitioned on the basis of a quad treestructure may be referred to as a coding tree block (CTB). One codingtree block may not be additionally partitioned. In this case, the codingtree block itself may be one coding unit. Therefore, the coding treeblock may correspond to a largest coding unit (LCU) which is a codingunit having the largest size. On the other hand, a coding unit havingthe smallest size in the coding tree block may be referred to as asmallest coding unit (SCU).

In FIG. 3, reference numeral 310 denotes a coding tree block. The codingtree block 310 may have a hierarchical structure including smallercoding units (for example, a, b, and c) by partitioning. Thehierarchical structure of the coding tree block 310 may be specified onthe basis of size information, depth information, partition flaginformation, and the like.

For example, the coding unit a may correspond to a block obtained bypartitioning the coding tree block 310 one time and the partition depthof the coding unit a may be 1. The coding unit b may correspond to ablock obtained by partitioning the coding tree block 310 two times andthe partition depth of the coding unit b may be 2. The coding unit c maycorrespond to a block obtained by partitioning the coding tree block 310three times and the partition depth of the coding unit c may be 3. Whenthe coding tree block is used as a coding unit without beingpartitioned, the partition depth of the coding unit may be 0. Thepartition depth of the coding unit may be indicated, for example, by“cuDepth” or “ctDepth”.

The size information, the partition flag information, and the likeindicating the hierarchical structure of the coding tree block 310 maybe transmitted from the video encoder to the video decoder in a statewhere they are included in a sequence parameter set (SPS), a slicesegment header, and/or a coding quad-tree syntax.

One coding unit may be partitioned into plural transform units (TUs) onthe basis of the quad-tree structure. Similarly to the process ofpartitioning a coding tree block, a coding unit may be repeatedlypartitioned with a depth on the basis of the quad-tree structure. Here,a block which cannot be partitioned any more may correspond to atransform unit (TU). A coding unit which cannot be partitioned any moremay correspond to a transform unit.

In FIG. 3, reference numeral 320 denotes a coding unit (coding unit b).Referring to FIG. 3, the coding unit 320 may have a hierarchicalstructure including smaller transform units (for example, d, e, and f)by partitioning. Here, the hierarchical structure may be called“transform tree” to correspond to a coding tree. The hierarchicalstructure of the transform tree may be indicated by a transform treesyntax (for example, transform_tree( ), and may be specified on thebasis of the size information, the depth information, the partition flaginformation, and the like thereof.

For example, the transform unit d may correspond to a block obtained bypartitioning the coding unit 320 one time and the partition depth of thetransform unit d may be 1. The transform unit e may correspond to ablock obtained by partitioning the coding tree block 320 two times andthe partition depth of the transform unit e may be 2. The transform unitf may correspond to a block obtained by partitioning the coding treeblock 320 three times and the partition depth of the transform unit fmay be 3. When the coding unit is used as a transform unit without beingpartitioned, the partition depth of the transform unit may be 0. Thepartition depth of the transform unit may be indicated, for example, bya parameter “traDepth”.

The size of a transform unit may be indicated, for example, by aparameter “log 2TrafoSize”. Here, the actual size of the transform unitmay correspond to 2^(log 2TrafoSize) or 1<<log 2TrafoSize.

The partition flag information may be included in a transform treesyntax and may be transmitted from the video encoder to the videodecoder in this state. Here, the partition flag information may indicatewhether each block is partitioned into four blocks in the course ofpartitioning the transform tree structure.

Information (for example, log 2_min_transform_block_size_minus2) on thesmallest transform size (the size of the smallest transform unit or thesize of the smallest transform block) allowable in a sequence may beincluded in an SPS and may be transmitted from the video encoder to thevideo decoder in this state. Information (for example, log2_diff_max_min_transform_block_size) on the difference between thelargest transform size (the size of the large transform unit or the sizeof the largest transform block) and the smallest transform size may alsobe transmitted from the video encoder to the video decoder through theuse of the SPS. The video decoder may derive the largest transform sizeallowable in the sequence on the basis of the information on thesmallest transform size and the information on the difference betweenthe largest transform size and the smallest transform size. For example,the largest transform size may be indicated by a parameter “Log2MaxTrafoSize”. Here, the actual largest transform size may correspondto 2^(Log 2MaxTrafoSize) or 1<<Log 2MaxTrafoSize.

On the other hand, the transform tree syntax may be defined in a codingunit syntax. However, when a residual signal or residual information ofa coding unit is not present, information of the coding unit may beexpressed by only information on the prediction without using theinformation on the transform tree.

Flag information on whether a residual signal and/or residualinformation of a current coding unit is present may be included in acoding unit syntax and may be transmitted from the video encoder to thevideo decoder in this state. At this time, the flag information maycorrespond to a flag indicating whether a transform tree syntax of thecurrent coding unit is present. The flag may be indicated, for example,by a syntax element of “no_residual_data_flag” or“no_residual_syntax_flag”.

The information transmitted from the video encoder to the video decodermay include coded block flag (CBF) information. For example, the codedblock flag information may be defined in the transform tree syntax.

The coded block flag information may indicate whether respectivetransform blocks of a luma component (Y) and chroma components Cb and Crinclude a transform coefficient other than 0. For example, the codedblock flag for a luma component may indicate whether a luma componenttransform block includes one or more transform coefficients other than0. For example, the coded block flag for a luma component may beindicated by a syntax element “cbf_luma”. That is, “cbf_luma” mayindicate when residual information is present for the luma components ofa transform block. The coded block flag for a chroma component mayindicate whether a chroma component transform block includes one or moretransform coefficients other than 0. The coded block flag for a chromacomponent may be indicated by a syntax element “cbf_cb” or “cbf_cr”depending on the corresponding chroma component. That is, “cbf_cb” or“cbf_cr” may indicate whether residual information is present for thechroma components of a transform block.

When quantization parameter (QP) adaptation in the unit of CU isapplied, that is, when a QP is adaptively determined in the unit of CU,QP delta information may be transmitted from the video encoder to thevideo decoder. Here, the QP delta information means informationindicating a different value between the value of a quantizationparameter for a CU and the predicted value of the quantizationparameter.

For example, the QP delta information may be transmitted from the videoencoder to the video decoder through the use of a syntax element“cu_qp_delta”. For example, the QP delta information may be transmittedthrough the use of syntax elements of “cu_qp_delta_abs” indicating theabsolute value of the difference value between the value of thequantization parameter for the CU and the predicted value of thequantization parameter and “cu_qp_delta_sign” indicating the sign of thedifference value.

The names of the syntax elements and the parameters described in theabove-mentioned embodiment are arbitrary and the invention is notlimited to the names. The names of the syntax elements and theparameters defined in this specification are arbitrary, and the syntaxelements and the parameters having functions identical or similarthereto are included in the scope of the invention regardless of thenames. When a syntax element or a parameter or a parameter having thesame name as in the above-mentioned embodiment is mentioned in thisspecification, the syntax element or the parameter may be analyzed tohave the same meaning in the above-mentioned embodiment.

On the other hand, entropy coding (entropy encoding/entropy decoding)may be used to process video information requiring high codingefficiency. Video information may be entropy-encoded and then may betransmitted to the video decoder as described above with reference toFIG. 1. The video decoder may entropy-decode a received bitstream toacquire the video information as described above with reference to FIG.2.

CABAC (Context-based Adaptive Binary Arithmetic Code) may be used toentropy-encode/decode video information. In the CABAC, the term,“context-based”, may mean that a coding method having higherencoding/decoding efficiency is adaptively selected depending oncircumstances. In this regard, use of different contexts may mean thatcoding is performed using different probability models by independentlyupdating contexts.

Embodiments of the entropy-encoding/entropy-decoding methods based onthe CABAC will be described below.

FIG. 4 is a block diagram schematically illustrating an example of aconfiguration of an entropy encoding module according to the invention.

Referring to FIG. 4, an entropy encoding module 400 includes abinarization module 410, a regular encoding engine 420, and a bypassencoding engine 430. Here, the entropy encoding module 400 may be theentropy encoding module 130 illustrated in FIG. 1.

The value of a syntax element may be input to the binarization module410. The binarization module 410 may convert the value of the syntaxelement into a bin string and may output the bin string. Here, the binstring may mean a binary sequence or a binary code including one or morebins. The bin may mean a value (0 or 1) of each digit constituting abinary sequence (or binary code) when the value of a symbol and/or asyntax element is binarized to a binary sequence (or binary code).

A predetermined binarization method or a predetermined binarization typemay be applied to each syntax element and the binarization method may bedetermined to be different depending on the syntax elements. Examples ofthe binarization type that can be applied to syntax elements includeunary binarization, truncated unary binarization, truncated ricebinarization, Exp-Golomb binarization, and fixed-length binarization.

A binarized signal (bin string) may be input to the regular encodingengine 420 or the bypass encoding engine 430. The entropy encodingmodule 400 may determine whether to perform the entropy encoding usingthe regular encoding engine 420 or to perform the entropy encoding usingthe bypass encoding engine 430 and may switch an encoding path. Theregular encoding engine 420 and the bypass encoding engine 430 mayperform arithmetic encoding.

The regular encoding engine 420 may allocate a context reflecting aprobability value to the corresponding bin and may encode the bin on thebasis of the allocated context. The regular encoding engine 420 mayupdate the probability and/or the context for the corresponding binafter encoding the bins.

The bypass encoding engine 430 may not allocate a context to an inputbin but encode a bin input through a simple bypass mode, therebyenhancing an encoding rate. In the bypass mode, the process ofestimating the probability for the input bin and the process of updatingthe probability applied to the bin may be bypassed. For example, in thebypass mode, a uniform probability distribution may be applied toperform the encoding process.

FIG. 5 is a block diagram schematically illustrating an example of aconfiguration of an entropy decoding module according to the invention.

Referring to FIG. 5, the entropy decoding module 500 includes abinarization module 510, a regular decoding engine 520, and a bypassdecoding engine 530. Here, the entropy decoding module 500 may be theentropy decoding module 210 illustrated in FIG. 2.

The binarization module 510 may derive binarization of a syntax elementin response to a request to the syntax element. Here, the derivation of“binarization” may mean a process of acquiring bin strings (or binarycodes) by performing binarization on possible values of the syntaxelement. That is, the binarization result for the syntax element in FIG.5 may mean binary codes for the possible values of the syntax element.

As described above, a predetermined binarization method or apredetermined binarization type may be applied to each syntax elementand the binarization method may be determined to be different dependingon the syntax elements. Examples of the binarization type that can beapplied to syntax elements include unary binarization, truncated unarybinarization, truncated rice binarization, Exp-Golomb binarization, andfixed-length binarization.

The “binarization” of each syntax element may be derived by thebinarization module 510 through a predetermined calculation process, anda predetermined table or resultant values indicating the “binarization”may be stored in advance in the video decoder. When the binarizationresults (for example, a mapping relationship between the syntax elementvalues and the binary codes) of an input signal are stored in advance inthe video decoder, the input signal may not be processed by thebinarization module 510. In this case, the configuration of thebinarization module 510 may be removed from the example illustrated inFIG. 5.

The entropy decoding module 500 may determine whether to perform thedecoding using the regular decoding engine 520 or to perform thedecoding using the bypass decoding engine 530 for each bin of arequested syntax element. This process may be performed by thebinarization module 510 or may be performed by a separate configurationindependent of the binarization module 510.

When a syntax element (or bins of the syntax element) is decoded usingthe regular decoding engine 520, the entropy decoding module 500 may setoffset values to define different context depending on a slice type. Theprocess of setting offset values may be performed by the binarizationmodule 510 or may be performed by a separate configuration independentof the binarization module 510.

The offset values may be used to derive context indices. Here, a contextindex may mean an index indicating a context to be applied to a decodingtarget bin. The offset in this specification is referred to as a contextindex offset and may be indicated, for example, by “ctxIdxOffset”.

For example, the values of context index offsets may be determineddepending on the slice type of a current slice. That is, the values ofcontext index offset values may be determined depending on whether thecurrent slice is an I slice, a P slice, or a B slice. Since the valuesof the context index offsets are used to derive context indices, theentropy decoding module 500 may allocate different context indices tothe same bin index depending on the slice type of the current slice.

When it is determined to use the regular decoding engine, the regulardecoding engine 520 may perform a decoding process based on contexts.

In the entropy-encoded values for the syntax elements, the bins may beindexed by bin indices. For example, a bin index value of 0 may beallocated to the first bin, a bin index value of 1 may be allocated tothe second bin, and a bin index value of n−1 may be allocated to then-th bin (where n is an integer of 0 or greater). The regular decodingengine 520 may derive a context index ctxIdx for each bin.

In order to derive context indices, the regular decoding engine 520 maydetermine context index increments on the basis of the requested syntaxelement and the bin indices of the bins to be decoded. For example, theregular decoding engine 520 may determine the context index incrementson the basis of a “context table” stored in advance in the videodecoder. The context index increments may be indicated, for example, bya parameter “ctxIdxInc”. The regular decoding engine 520 may derive thecontext index of the corresponding bin by adding the context indexincrement to the context index offset. That is, the context index ctxIdxmay be indicated by the sum of the context index offset ctxIdxOffsetdetermined depending on the slice type and the context index incrementctxIdxInc determined for each bin.

When the context index is derived, the regular decoding engine 520 mayperform an arithmetic decoding process on the decoding target bin on thebasis of the context index. Here, a probability parameter pStateIdxinitialized on the basis of the context index may be used for thearithmetic decoding process. Here, the probability parameter may mean aparameter indicating the occurrence probability of a bin. The initialvalue for deriving the probability parameter may be determined using thecontext index and a “context index table”. The context index tableapplied to the corresponding syntax element may be specified by apredetermined index, for example, a context index table indexctxIdxTable. The regular decoding engine 520 may update the probabilityparameter (and/or context) of the corresponding bin after performing thedecoding on the respective bins.

When the bypass decoding engine is determined to be used, the bypassdecoding engine 530 may perform the decoding using a uniform probabilitydistribution. Accordingly, the bypass decoding engine 530 may not derivethe context indices unlike the regular decoding engine 520.

A binary code may be output through the decoding in each of the regulardecoding engine 520 and the bypass decoding engine 530.

When the decoding engines complete the decoding on all the bins of aspecific syntax element, the entropy decoding module 500 may determineon what syntax element the binary code as the sum of all the bins of thecorresponding syntax element is mapped. Here, for example, the“binarization” result derived by the binarization module 510 may beused. When the output final binary code is mapped on a specific syntaxelement value, the value may be determined to the value of the syntaxvalue.

FIG. 6 is a flowchart schematically illustrating an example of anentropy decoding process according to the invention. For the purpose ofconvenience of explanation, FIG. 6 illustrates a decoding process on asingle bin as an example.

The decoding process illustrated in FIG. 6 may be performed by the videodecoder, more specifically, by the entropy decoding module of the videodecoder. For the purpose of convenience of explanation, it is assumedthat the processes are performed by the entropy decoding module.

Referring to FIG. 6, the entropy decoding module may determine whetherto perform bypass decoding on an input target bin to be decoded (S610).The entropy decoding module may determine whether to perform the bypassdecoding on the basis of information on the target bin. For example,when a fixed context based on a table is used, the entropy decodingmodule may determine whether to perform the bypass decoding on the basisof an instruction allocated to the corresponding syntax element in thetable. When the fixed context based on the table is used, the entropydecoding module may determine whether to perform the bypass decoding onthe basis of an index, an offset, and the like allocated to thecorresponding syntax element in the table.

When it is determined that the bypass decoding is performed, the entropydecoding module may perform the bypass decoding on the input bin (S620).When the bypass decoding is performed, the entropy decoding module mayuse a uniform probability distribution like the encoding. The entropydecoding module may compare a code interval range codIRange and a codeinterval offset codIOffset and may allocate the value of the bin,depending on the state of the bypass decoding engine. For example, thevalue of the bin may be set to 1 when the code interval offset is equalto or greater than the code interval range, and the value of the bin maybe set to 0 when the code interval offset is less than the code intervalrange. Here, in order to directly compare the code interval range andthe code interval offset, the code interval range or the value of thecode interval offset may be appropriately adjusted.

When it is determined in step S610 that the bypass decoding is notperformed, the entropy decoding module may determine whether a decodingtermination condition is satisfied (S630). For example, when the valueof the context index ctxIdx is 0 and the value of the context indextable index ctxIdxTable is 0, the entropy decoding module may terminatethe decoding process. Whether the terminal condition is satisfied maynot be determined on the basis of the values of the indices, but may bedetermined on the basis of flag information or syntax informationtransmitted from the video encoder. Here, the termination conditionindicated by the flag information or the syntax information and thetermination condition determined on the basis of the index values may beequal to each other.

When the termination condition is satisfied, the entropy decoding modulemay terminate the decoding process as described above (S640). Theentropy decoding module may allocate a predetermined set value to thevalue of the bin before terminating the decoding process. Here, theentropy decoding module may allocate the value of the bin by the bypassdecoding.

When the termination condition is not satisfied, the entropy decodingmodule may perform the decoding process (S650). The entropy decodingmodule may perform the arithmetic decoding on the bin to be decoded onthe basis of the bin index (for example, binIdx) indicating the bin tobe decoded and the context index (for example, ctxIdx) indicating thecontext to be applied to the bin to be decoded.

FIG. 7 is a flowchart schematically illustrating an example of theentropy decoding process when the regular decoding engine is used. Forthe purpose of convenience of explanation, FIG. 7 illustrates a decodingprocess on a single bin as an example.

The decoding process illustrated in FIG. 7 may be performed by the videodecoder, more specifically, by the entropy decoding module of the videodecoder. For the purpose of convenience of explanation, it is assumedthat the processes are performed by the entropy decoding module.

Referring to FIG. 7, the entropy decoding module may derive binarizationfor the corresponding syntax element in response to a request for thesyntax element (S710). Here, the deriving of “binarization” may mean aprocess of acquiring bin strings (or binary codes) by performing abinarization process on the possible values of the syntax element. Asdescribed above, when the binarization result (for example, the mappingrelationship between the syntax element values and the binary codes) ofan input signal is stored in advance in the video decoder, thebinarization deriving process of S710 may be skipped. A specific exampleof the binarization method or the like is described above with referenceto FIG. 5 and thus description thereof will not be repeated.

Referring to FIG. 7 again, the entropy decoding module may derive thecontext index (ctxIdx) of the bin to be decoded (S720).

As described above, the entropy decoding module may determine the valueof the context index offset (ctxIdxOffset) for the syntax element sothat different contexts are defined depending on the slice types. Thevalue of the context index offset may be determined depending on whethera current slice is an I slice, a P slice, or a B slice.

In the entropy-encoded values for the syntax elements, the bins may beindexed by bin indices. The entropy decoding module may determine acontext index increment on the basis of the requested syntax element andthe bin index of the bin to be decoded. For example, the entropydecoding module may determine the context index increment on the basisof the “context table” stored in advance in the video decoder.

The entropy decoding module may derive the context index of the bin tobe decoded by adding the context index offset value and the contextindex increment.

Referring to FIG. 7 again, the entropy decoding module may perform thearithmetic decoding process on the bin to be decoded on the basis of thecontext index (S730). Here, the probability parameter (pStateIdx)initialized on the basis of the context index may be used for thearithmetic decoding process.

When the decoding engines complete the decoding on all the bins of aspecific syntax element, the entropy decoding module may determine onwhat syntax element the binary code as the sum of all the bins of thecorresponding syntax element is mapped. Here, for example, the“binarization” result derived in S710 may be used. When the output finalbinary code is mapped on a specific syntax element value, the value maybe determined to the value of the syntax value.

A decoding method using a context will be described below in moredetail.

Here, a context may be indicated by a context index increment(ctxIdxInc), a context index (ctxIdx), and/or a probability or aprobability parameter derived by the context index.

As described above, the context index may be indicated by the sum of thecontext index (ctxIdxOffset) determined depending on the slice type andthe context index increment (ctxIdxInc) determined for each bin. Thecontext index increment may be determined on the basis of the requestedsyntax element and the bin indices of bins to be decoded.

Since the context index increment corresponds to a factor for derivingthe context index along with the context index offset, the “contextindex increment” determined by a bin to be decoded, which has bin indexcorresponding to the context index increment, may be referred to as a“context index” for the purpose of convenience of explanation inembodiments to be described later. In this case, the type of an actualcontext used to express a probability model or to derive a probabilityparameter may be considered to be indicated by the sum of the “contextindex” and the “context index offset”. This distinction can beapparently understood by those skilled in the art.

Some embodiments to be described later may be described withoutconsidering the context index offset determined depending on the slicetype. The context applied to a bin to be decoded in such embodiments maybe considered to be determined without depending on the slice type andthe “context index increment” referred to as the “context index” may beconsidered to indicate the context of the bin to be decoded.

However, the invention is not limited to this configuration. In theembodiments in which the context index offsets are not considered inthis specification, the context index offsets determined depending onthe slice type may be additionally applied. In this case, the actualcontext of the bin to be decoded may be considered to be indicated bythe sum of the “context index offset” and the “context index increment”referred to as the context index.

As described above, the entropy coding (entropy encoding/entropydecoding) may be used to process video information requiring high codingefficiency. A variable length coding (VLC), the CABAC (Context-basedAdaptive Binary Arithmetic Code), and the like in addition to the basiccoding method such as the Expo-Golomb may be used for the entropycoding.

In the CABAC, the term, “context-based”, may mean that a coding methodhaving higher encoding/decoding efficiency is adaptively selecteddepending on circumstances. In this regard, use of different contextsmay mean that the coding is performed using different probability modelsby independently updating the contexts or updating the probabilities.

The following methods may be considered as the method of using thecontexts for the coding in the CABAC.

<Context Utilizing Method>

(a) Method of calculating contexts depending on circumstances and usingthe contexts for coding

(b) Method of defining a specific context table in advance so as to usea fixed context and using the context designated in the defined contexttable

(c) Bypass coding (bypass encoding/bypass decoding) method of coding(encoding/decoding) a binary code without referring to contexts.

(d) Method of using Methods (a) to (c) by selective combination thereof

Since Method (a) of the context utilizing methods includes a process ofcalculating contexts in consideration of circumstances before performingthe coding, Method (a) may have the highest complexity. For example, thevideo encoder may calculate contexts by bins constituting a binary codeof a syntax element to be coded in consideration for circumstances, forexample, contexts applied to the previous and subsequent bins orcontexts of blocks (for example, a left block or an upper block) codedpreviously to a current block. The video encoder may transmitinformation on the calculated contexts to the video decoder. The videodecoder may perform decoding on the corresponding bins on the basis ofthe received context information. For example, the video decoder may notdetermine and transmit the contexts of the bins, but the video encoderand the video decoder may calculate the contexts in consideration ofcircumstances using the same method.

Method (b) of the context utilizing methods is a method of setting acontext table in which context indices are allocated to the binsconstituting the binary code of a specific syntax element in advance andusing the contexts indicated by the context indices allocated in thecontext table for decoding the corresponding bins without calculatingthe contexts every time like in Method (a). When Method (b) is used, afixed context may be used for each bin.

Table 1 is a table schematically illustrating an example of a contexttable representing a mapping relationship between bin indices andcontext indices allocated to the bins when Method (b) is used.

TABLE 1 bin index (binIdx) Syntax element 0 1 2 3 4 context index by binIdx0 Idx1 Idx2 Idx3 Idx4

Table 1 shows an example of the context table applied to a correspondingsyntax element when it is assumed that the entropy coding is performedon the specific syntax element.

In the example of Table 1, the bin index binIdx may indicate a specificbin out of bins constituting a binary code of a syntax element. Here,the binary code may be a binary code encoded on the basis of thecontexts of the syntax element. The encoded binary code may be referredto as a codeword.

For example, the value of binIdx of 0 may indicate the first bin out ofthe bins constituting the codeword (or binary code) of the syntaxelement, and the value of binIdx of 3 may indicate the fourth bin out ofthe bins constituting the codeword (or binary code) of the syntaxelement. The syntax element may be a syntax element transmitted from thevideo encoder to the video decoder, such as cbf_luma, cu_qp_delta, andinter_pred_flag.

Referring to the example of Table 1, context indices may be allocated tothe bins 0 to 4 constituting the codeword (or binary code) of the syntaxelement, respectively. The context indices Idx0 to Idx4 may havedifferent values. The context index may indicate a context (and/or aprobability model) to be applied to the corresponding bin to be decoded.For example, the probability parameter (pStateIdx) may be initialized onthe basis of the context index and the initial value for deriving theprobability parameter may be determined on the basis of a particularcontext index table. That is, the context indicated by the context indexmay be allocated using a particular context index table.

The bins constituting the codeword (or binary code) of the syntaxelement may be decoded on the basis of the contexts (and/or probabilitymodels) indicated by the context indices allocated thereto.

When a syntax element is entropy-decoded, the video decoder may use thecontext, which is indicated by the context index allocated to a specificbin, to decode the specific bin. For example, when the bin index valueis 0, the first bin may be decoded using the context indicated by Idx0.

In the example of Table 1, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

Method (c) of the context utilizing methods has complexity lower thanthat of Method (a) or (b). In the bypass coding used in Method (c), auniform probability distribution is used as described above, and thebypass coding may be applied for the purpose of fast coding. Details ofthe bypass coding are described above and thus specific descriptionthereof will not be repeated.

In CABAC-decoding of a specific binary code, contexts may be applied tonumerals 0 or 1 of digits constituting the binary code. Here, the binarycode may be a binary code encoded on the basis of the contexts of thesyntax element. The numerals 0 or 1 of digits constituting the binarycode may be referred to as a bin as described above. For example, whenthe binary code (or codeword) is 110, the first bin is 1, the second bin1, and the third bin is 0.

In the CABAC coding, contexts may be determined in various ways for thebins constituting the codeword (or binary code) of the syntax element.

<Method of Determining Context of Bin Constituting Codeword (or BinaryCode)>

(A) Independent contexts may be applied to the bins constituting acodeword (or binary code) of a syntax element.

(B) The same context may be commonly applied to the bins constitutingthe codeword (or binary code) of the syntax element

(C) The bypass mode may be applied to the bins constituting the codeword(or binary code) of the syntax element. That is, the bypass coding maybe performed on the bins constituting the codeword (or binary code) ofthe syntax element.

(D) Methods (A) to (C) may be combined to determine the contexts of thebins constituting the codeword (or binary code) of the syntax element.

In Method (A), independent contexts may be applied to the binsconstituting the codeword (or binary code) of the syntax element.Accordingly, the contexts of the bins may be independently updated. InMethod (B), the same context may be applied to the bins constituting thecodeword (or binary code) of the syntax element and may be updated inthe same way. In Method (C), since all the bins constituting thecodeword (or binary code) of the syntax element are coded in the bypassmode, fast decoding may be performed.

In Method (D), Methods (A) to (C) may be combined and applied. Forexample, independent contexts may be applied to some bins of the binsconstituting the codeword (or binary code) of the syntax element and thesame context may be commonly applied to some bins. Independent contextsmay be applied to some bins of the bins constituting the codeword (orbinary code) of the syntax element and the bypass mode may be applied tosome bins. The same context may be applied to some bins of the binsconstituting the codeword (or binary code) of the syntax element and thebypass mode may be applied to some bins. Independent contexts may beapplied to some bins of the bins constituting the codeword (or binarycode) of the syntax element, the same context may be commonly applied tosome bins, and the bypass mode may be applied to some bins.

On the other hand, Methods (A) to (D) of determining contexts of thebins constituting the codeword (or binary code) of the syntax elementmay be performed along with Methods (a) to (d) of utilizing thecontexts.

For example, on the basis of Method (A), in a specific syntax (syntaxelement), independent contexts may be applied to all the binsconstituting the codeword (or binary code) of the syntax (syntaxelement) and the independent contexts may be calculated for therespective bins in consideration of circumstances. In a specific syntax(syntax element), independent contexts may be applied to all the binsconstituting the codeword (or binary code) of the syntax (syntaxelement), and the independent contexts may be indicated using apredetermined context table.

Table 2 shows an example where context indices are allocated using apredetermined context table when independent context indices areallocated to the bins constituting the codeword (or binary code) of asyntax element.

TABLE 2 bin index (binIdx) Syntax element A 0 1 2 3 4 context index bybin Idx0 Idx1 Idx2 Idx3 Idx4

Table 2 shows an example of a context table applied to specific syntaxelement A when entropy-coding is performed on syntax element A.

In Table 2, the context indices by bin (Idx0 to Idx4) may independentlyindicate contexts to be applied to the corresponding bins. Here, thecontexts indicated by the context indices may be independently updated.

In the example of Table 2, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

On the other hand, in a specific syntax (syntax element), independentcontexts may be applied to some bins of the bins constituting thecodeword (or binary code) of the syntax (syntax element) and the bypassmode may be applied to some bins. Here, the context indices or thebypass mode may be set independently by the bins in a predeterminedcontext table. For example, the context indices may be calculated inconsideration of circumstances as described above.

Table 3 shows an example of a context table that can be used whenindependent contexts are applied to some bins of the bins constitutingthe codeword (or binary code) of a specific syntax (syntax element) andthe bypass mode is applied to some bins.

TABLE 3 bin index (binIdx) Syntax element B 0 1 2 3 4 context index bybin Idx0 bypass Idx1 bypass Idx2

Table 3 shows an example of a context table applied to specific syntaxelement B when entropy-coding is performed on syntax element B.

In the example of Table 3, independent contexts may be applied to thefirst, third, and fifth bins of the bins constituting the codeword (orbinary code) of syntax element B, and the bypass mode may be applied tothe second and fourth bins.

In the example of Table 3, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

On the basis of Method (A) and Method (B), in a specific syntax (syntaxelement), independent contexts may be applied to some bins of the binsconstituting the codeword (or binary code) of the syntax (syntaxelement) and the same context may be commonly applied to some bins. Forexample, the context indices may be calculated for the correspondingbins in consideration of circumstances. For example, the context indicesmay be indicated using a predetermined context table.

Table 4 shows an example where context indices are allocated using apredetermined context table when independent contexts are applied tosome bins of the bins constituting the codeword (or binary code) of asyntax element and the same context is commonly applied to some bins.

TABLE 4 bin index (binIdx) Syntax element C 0 1 2 3 4 context index bybin Idx0 Idx1 Idx1 Idx2 Idx3

Table 4 shows an example of a context table applied to specific syntaxelement C when entropy-coding is performed on syntax element C.

In Table 4, the context indicated by the context index Idx1 may beapplied to the second and third bins. The contexts indicated by thecontext indices Idx0, Idx2, and Idx3 may be applied to the first,fourth, and fifth bins. The context indices Idx0 to Idx3 may have valuesdifferent from each other, and the contexts indicated by the contextindices may be independently updated.

In the example of Table 4, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

On the other hand, in a specific syntax (syntax element), independentcontexts may be applied to some bins of the bins constituting thecodeword (or binary code) of the syntax (syntax element), the samecontext may be commonly applied to some bins, and the bypass mode may beapplied to some bins.

Here, for example, the context indices may be calculated inconsideration of circumstances. For example, the context indices or thebypass mode may be set or indicated by bins in a predetermined contexttable.

Table 5 shows an example of a context table that can be used whenindependent contexts are applied to some bins of the bins constitutingthe codeword (or binary code) of a specific syntax (syntax element), thesame context is commonly applied some bins, and the bypass mode isapplied to some bins.

TABLE 5 bin index (binIdx) Syntax element D 0 1 2 3 4 context index bybin Idx0 bypass Idx1 Idx2 Idx2

Table 5 shows an example of a context table applied to specific syntaxelement D when entropy-coding is performed on syntax element D.

In the example of Table 5, the context indicated by the context indexIdx0 may be applied to the first bin of the bins constituting thecodeword (or binary code) of syntax element D, the bypass mode may beapplied to the second bin, the context indicated by the context indexIdx1 may be applied to the third bin, and the context indicated by thecontext indices Idx2 may be applied to the fourth and fifth bins.

In the example of Table 5, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

On the other hand, on the basis of Method (B), the same context may becommonly applied to the bins constituting the codeword (or binary code)of a specific syntax (syntax element). For example, the context indexcommonly applied may be calculated for the corresponding bins inconsideration of circumstances. For example, the context index commonlyapplied may be allocated using a predetermined context table.

Table 6 shows an example of a context table that can be used when thesame context is applied to the bins constituting the codeword (or binarycode) of a specific syntax (syntax element).

TABLE 6 bin index (binIdx) Syntax element E 0 1 2 3 4 context index bybin Idx0 Idx0 Idx0 Idx0 Idx0

Table 6 shows an example of a context table applied to specific syntaxelement E when entropy-coding is performed on syntax element E.

In the example of Table 6, the context indicated by the context indexIdx0 may be commonly applied to the bins constituting the codeword (orbinary code) of syntax element E.

In the example of Table 6, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

In a specific syntax (syntax element), the same context may be commonlyapplied to some bins of the bins constituting the codeword (or binarycode) of a specific syntax (syntax element), and the bypass mode may beapplied to some bins.

For example, the context indices may be calculated in consideration ofcircumstances at the time applying contexts to the corresponding bins.For example, the context indices or the bypass mode may be set orindicated by bins in a predetermined context table.

Table 7 shows an example of a context table that can be used when thesame context index is applied to some bins of the bins constituting thecodeword (or binary code) of a specific syntax (syntax element) and thebypass mode is applied to some bins.

TABLE 7 bin index (binIdx) Syntax element F 0 1 2 3 4 context index bybin Idx0 Idx0 bypass Idx0 Idx0

Table 7 shows an example of a context table applied to specific syntaxelement F when entropy-coding is performed on syntax element F.

In the example of Table 7, the bypass mode may be applied to the thirdbin of the bins constituting the codeword (or binary code) of syntaxelement F and the context indicated by the context index Idx0 may beapplied to the first, second, fourth, and fifth bins.

In the example of Table 7, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

On the basis of Method (C), in a specific syntax (syntax element), thebypass mode may be applied to all the bins constituting the codeword (orbinary code) of the syntax (syntax element). For example, theapplication of the bypass mode may be indicated using a predeterminedcontext table for the corresponding syntax (syntax element). Here, thecontext table may be configured so that the bypass mode is allocated toall the bins.

On the other hand, in the context table, different context indices maybe allocated to the same bin index. Here, the context index actuallyapplied to the bin to be decoded may be determined depending on thecircumstances or by predetermined computation.

The context index may differ depending on an environment (state orcondition) to which the syntax (syntax element) is applied. For example,different contexts may be applied to the bin at the same position in acodeword (or binary code) depending on states or conditions such as theblock type, the slice type, the prediction mode, the block size, and theblock depth. Here, a certain state may be specified by anotherequivalent state. For example, the block size may be specified by theblock depth and the block depth may be specified by the block size.Accordingly, these two conditions may be the state or conditionspecifying the same environment.

The context index offsets may be used to apply different contexts to thebins constituting a codeword (or binary code) depending on the state orcondition. In this case, a context applied to a specific bin may beindicated by the sum of the context index values allocated to the binindices in the context table and the context index offset values addedby conditions. As described above, the context index may mean thecontext index increment described in the embodiments of FIGS. 4 to 7,and the value indicated by the sum of the context index offset and thecontext index value may correspond to the context index value describedwith reference to FIGS. 4 to 7. In this specification, the context indexincrement in the examples of Table 1 and the tables subsequent theretois referred to as the context index for the purpose of convenience ofexplanation.

Table 8 schematically shows an example of a context table that can beused when different contexts are applied to the same bin on the basis ofthe context index offset.

TABLE 8 context index by bin offset 0 1 2 3 4 A1 B0 B1 B2 B3 B4 A2 B0 B1B2 B3 B4 A3 B0 B1 B2 B3 B4

In the example of Table 8, 0 to 4 represent the bin index (binIdx)values. The context index offset values A1, A2, and A3 may be differentfrom each other. All or some of the context indices B0, B1, B2, B3, andB4 allocated by bin indices may have different values.

In the example of Table 8, the maximum value maxBinIdxCtx of the binindices is 4, but the maximum value of the bin indices may be greaterthan 4 or smaller than 4. Here, no context index may be allocated to thebin indices greater than the maximum value or NA (not available) may beallocated thereto.

The context index offset value may be set depending on a predeterminedstate or condition. For example, the context index offset value may beset depending on the slice type (I slice, P slice, or B slice). Here, A1may be the offset for the I slice, A2 may be the offset for the P slice,and A3 may be the offset for the B slice. The offset value may bedirectly determined from the state information or condition such as theslice type or may be determined using a parameter value such as apredetermined type (for example, initType) determined by the stateinformation or condition such as the slice type.

In each slice type, the offset values of a specific syntax element maybe fixed values, but may be a values adaptively determined on the basisof flag information or the like transmitted from the video encoder. Forexample, in a specific syntax element, the offset A1 for the I slice maybe fixed to 0, the offset A2 for the P slice may be fixed to 2, and theoffset A3 for the B slice may be fixed to 4. However, the offset A2 forthe P slice and the offset A3 for the B slice may be adaptivelydetermined depending on a predetermined condition. For example,depending on the specific flag information transmitted from the videoencoder, the offset A2 for the P slice and the offset A3 for the B slicemay be determined to be 2 and 4, respectively, or the offset A2 for theP slice and the offset A3 for the B slice may be determined to be 4 and2, respectively.

According to the above-mentioned examples, when the context index offsetvalue is not applied to a specific syntax element or the same contextindex offset value is applied thereto regardless of the slice type, acontext common to all the slice types may be applied to the same binindex. When different context index offset values are applied dependingon the slice type of a specific syntax element, different contexts maybe applied to the same bin index depending on whether the slice is the Islice, the P slice, or the B slice. That is, independent contexts or thecommon context may be applied to the bins constituting the codeword (orbinary code) of the syntax element.

The examples of Tables 1 to 8 may be combined and applied to a syntaxelement (or the bins constituting the codeword (or binary code) of thesyntax element) transmitted in the coding process. The examples ofTables 1 to 8 is not applied to only a specific syntax element, but maybe applied to various syntax elements.

Specific examples of a method of determining contexts (and/or whetherthe bypass coding is applied) to be applied to individual syntaxelements will be described below. Examples to be described below may bespecific examples in which the examples of Tables 1 to 8 are combined,but the invention is not limited to the examples. The examples of Tables1 to 8 may be combined in various forms and may be applied to the syntaxelements. The examples to be described below may be described on thebasis of a context table as in the examples of Tables 1 to 8. Here, thecontext index offsets to be applied to the corresponding syntax element,the context indices based on the bin indices, and/or whether to applythe bypass coding may be allocated using a context table.

The offset in the examples to be described below may mean the contextindex offset described above with reference to Table 8. In the examplesto be described below, the offset values applied to the slice types (Islice, P slice, and B slice) are described to be fixed values when theentropy coding is performed on a specific syntax element. However, theinvention is not limited to this example, and the offset values appliedto the slice types may be adaptively determined.

For example, in the examples to be described below, an offset value of 0may be allocated to the I slice, an offset value of 2 may be allocatedto the P slice, and an offset value of 4 may be allocated to the Bslice. The invention is not limited to this example, and the examplesmay be identically or similarly applied to a case where an offset valueof 0 is allocated to the I slice, an offset value of 4 is allocated tothe P slice, and an offset value of 2 is allocated to the B slice.

On the other hand, in the example of Table 8 and the examples to bedescribed below, the context index offset values determined depending onthe slice types and the context index values determined depending on thebin indices are indicated using one context table. However, theinvention is not limited to this example, and the context index offsetvalues determined depending on the slice types and the context indexvalues determined depending on the bin indices may be indicated usingdifferent context tables. Here, the context index offset values and thecontext index values may be independently determined. In this case, thecontexts to be applied to bins to be decoded may be indicated by the sumof the context index offset values and the context index values whichare independently determined.

Table 9 shows an example of a context table that can be applied to asyntax element “inter_pred_flag”. In the context table, the offsets, thecontext indices, and/or information indicating whether to apply thebypass mode may be set. The contexts to be applied to the binsconstituting the codeword (or binary code) of the syntax element“inter_pred_flag” may be indicated by the sum of the offsets and thecontext indices.

TABLE 9 context index by bin example Offset 0 m 0 X n 0 bypass o 0cuDepth p 0 trafoDepth

In Table 9, m, n, o, and p represent examples different from each other.

As described above, inter_pred_flag may indicate whether the LCprediction is applied to a current block (for example, PU) orbi-prediction is applied to the current block. Here, inter_pred_flag maybe considered to indicate the inter prediction direction of the currentblock. Since inter_pred_flag indicates one of two values, only a binindex (binIdx) value may be present in the codeword (or binary code) ofinter_pred_flag.

Referring to the example of Table 9, a context index offset value of 0may be applied to the syntax element inter_pred_flag regardless of theslice type. Accordingly, the same context may be applied to the same binindex. However, this is only an example, and the offset values in Table9 may be set to be different from the values shown in Table 9 so as toindicate suitable contexts, and may have different values depending onthe slice type.

In Example m, a predetermined fixed context may be applied to bin index0 of the syntax element inter_pred_flag. Here, a predetermined fixedcontext index (X) may be applied to bin index 0. Here, X may be a fixedvalue such as 0 or 1. In Example n, the bypass coding may be applied tobin index 0 of the syntax element inter_pred_flag.

On the other hand, as described above, the context index may differdepending on the environment (state or condition) in which the syntaxelement is applied. For example, as for the same bin (or bin index),different contexts may be applied to the bins at the same position inthe codeword (or binary code) depending on the state or condition suchas the depth of a block to which the syntax element is applied. InExamples o and p, the context indices are determined depending on thebit of a block or unit to which the syntax element is applied.

In Example o, the depth (cuDepth or ctDepth) value of a coding unit (CU)to which the corresponding syntax element is applied may be allocated orused as a context index to bin index 0 of the syntax elementinter_pred_flag. Accordingly, in Example o, different contexts may beapplied to bin index 0 of the syntax element inter_pred_flag dependingon the depth of the coding unit.

In Example p, the depth (traDepth) value of a transform unit (TU) towhich the corresponding syntax element is applied may be allocated orused as a context index to bin index 0 of the syntax elementinter_pred_flag. Accordingly, in Example o, different contexts may beapplied to bin index 0 of the syntax element inter_pred_flag dependingon the depth of the transform unit.

Table 9 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 9 may be setto be different from the values shown in Table 9 so as to indicatesuitable contexts.

Table 10 shows an example of a context table that can be applied to asyntax element “cu_qp_delta”. In the context table, the offsets, thecontext indices, and/or information indicating whether to apply thebypass mode may be set. The contexts to be applied to the binsconstituting the codeword (or binary code) of the syntax element“cu_qp_delta” may be indicated by the sum of the offsets and the contextindices.

TABLE 10 Slice context index by bin type offset 0 1 2 3 4 I 0 0 bypass 12 2 P 3 0 bypass 1 2 2 B 6 0 bypass 1 2 2

As described above, cu_qp_delta may indicate a difference between thevalue of a quantization parameter for a CU and the predicted value ofthe quantization parameter.

In the example of Table 10, different offset values may be set dependingon the slice type. For example, the context index offset value ofcu_qp_delta may be set to 0 in the I slice, the context index offsetvalue of cu_qp_delta may be set to 3 in the P slice, and the contextindex offset value of cu_qp_delta may be set to 6 in the B slice.Accordingly, in the example of Table 10, different contexts may beallocated by conditions by applying different offsets depending on thestate information or the condition.

However, this is only an example, the offset values in Table 10 may beset to be different from the values shown in Table 10 so as to indicatesuitable contexts, and an offset value common to all the slice types maybe applied.

In Table 10, independent contexts may be applied to some bins, the samecontext may be commonly applied to some bins, and the bypass mode may beapplied to the other bins.

For example, in the example of Table 10, a context index by bin of 0 maybe allocated to bin index 0 indicating the first bin of the codeword (orbinary code) of cu_qp_delta, and a context index by bin of 1 may beallocated to bin index 2 indicating the third bin of the codeword (orbinary code) of cu_qp_delta. A context index by bin of 2 may be commonlyallocated to bin index 3 and bin index 4 indicating the fourth bin andthe fifth bin of the codeword (or binary code) of cu_qp_delta. Thebypass mode may be applied to the second bin to which bin index 1 isallocated.

Table 10 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 10 may beset to be different from the values shown in Table 10 so as to indicatesuitable contexts.

Table 11 shows another example of a context table that can be applied toa syntax element “cu_qp_delta”. In the context table, the offsets, thecontext indices, and/or information indicating whether to apply thebypass mode may be set. The contexts to be applied to the binsconstituting the codeword (or binary code) of the syntax element“cu_qp_delta” may be indicated by the sum of the offsets and the contextindices.

TABLE 11 Slice context index by bin type offset 0 1 2 3 4 I 0 0 bypassbypass bypass bypass P 1 0 bypass bypass bypass bypass B 2 0 bypassbypass bypass bypass

In the example of Table 11, different offset values may be set dependingon the slice type. For example, the context index offset value ofcu_qp_delta may be set to 0 in the I slice, the context index offsetvalue of cu_qp_delta may be set to 1 in the P slice, and the contextindex offset value of cu_qp_delta may be set to 2 in the B slice.Accordingly, in the example of Table 11, different contexts may beallocated by conditions by applying different offsets depending on thestate information or the condition.

However, this is only an example, the offset values in Table 11 may beset to be different from the values shown in Table 11 so as to indicatesuitable contexts, and an offset value common to all the slice types maybe applied.

In Table 11, independent contexts may be applied to some bins and thebypass mode may be applied to the other bins.

For example, in the example of Table 11, a context index by bin of 0 maybe allocated to bin index 0 indicating the first bin of the codeword (orbinary code) of cu_qp_delta, and a context index by bin of 1 may beallocated to bin index 2 indicating the third bin of the codeword (orbinary code) of cu_qp_delta. In Table 11, the bypass mode may be appliedto the bins other than the first bin to which bin index 0 is allocated.That is, the bypass mode may be applied to the second bin to which binindex 1 is allocated, the third bin to which bin index 2 is allocated,the fourth bin to which bin index 3 is allocated, and the fifth bin towhich bin index 4 is allocated.

Table 11 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 11 may beset to be different from the values shown in Table 11 so as to indicatesuitable contexts.

Table 12 shows still another example of a context table that can beapplied to a syntax element “cu_qp_delta”. In the context table, theoffsets, the context indices, and/or information indicating whether toapply the bypass mode may be set. The contexts to be applied to the binsconstituting the codeword (or binary code) of the syntax element“cu_qp_delta” may be indicated by the sum of the offsets and the contextindices.

TABLE 12 Slice context index by bin type offset 0 1 2 3 4 I 0 bypassbypass bypass bypass bypass P 1 bypass bypass bypass bypass bypass B 2bypass bypass bypass bypass bypass

In the example of Table 12, different offset values may be set dependingon the slice type. For example, the context index offset value ofcu_qp_delta may be set to 0 in the I slice, the context index offsetvalue of cu_qp_delta may be set to 1 in the P slice, and the contextindex offset value of cu_qp_delta may be set to 2 in the B slice.Accordingly, in the example of Table 12, different contexts may beallocated by conditions by applying different offsets depending on thestate information or the condition.

However, this is only an example, the offset values in Table 12 may beset to be different from the values shown in Table 12 so as to indicatesuitable contexts, and an offset value common to all the slice types maybe applied.

In Table 12, instead of using contexts, the bypass mode may be appliedto all the bins constituting the codeword (or binary code) ofcu_qp_delta. For example, in the example of Table 12, the bypass modemay be applied to all of the first bin to which bin index 0 isallocated, the second bin to which bin index 1 is allocated, the thirdbin to which bin index 2 is allocated, the fourth bin to which bin index3 is allocated, and the fifth bin to which bin index 4 is allocated.

In the examples of Tables 10 to 12, the codeword (or binary code) of thesyntax element includes five bins, but the invention is not limited tothis example. When the codeword (or binary code) of the syntax elementcu_qp_delta includes bins less than five, for example, n (where n<5)bins, no context index may be allocated to the bin indices greater thann−1 or NA (not available) may be allocated thereto. When the codeword(or binary code) of the syntax element cu_qp_delta includes bins equalto or greater than five, the same context index as the context indexallocated to the sixth bin may be allocated to the sixth bin or the binssubsequent thereto (for example, bin indices having a value of 5 orgreater).

Table 13 shows an example of a context table that can be applied to asyntax element “no_residual_data_flag” and/or “no_residual_syntax_flag”.In the context table, the offsets, the context indices, and/orinformation indicating whether to apply the bypass mode may be set. Thecontexts to be applied to the bins constituting the codeword (or binarycode) of the syntax element “no_residual_data_flag” and/or“no_residual_syntax_flag” may be indicated by the sum of the offsets andthe context indices.

TABLE 13 context index by bin example offset 0 t 0 X u 0 bypass

In Table 13, t and u represent examples different from each other.

As described above, the syntax element “no_residual_data_flag” and/or“no_residual_syntax_flag” may indicate whether a residual signal and/orresidual information is present for a coding unit to which the syntaxelement is applied. Here, “no_residual_data_flag” and/or“no_residual_syntax_flag” may be considered to indicate whether atransform tree syntax is present for the coding unit to which the syntaxelement. Since “no_residual_data_flag” and/or “no_residual_syntax_flag”indicates one of two values, only the bin index (binIdx) value of 0 maybe present in the codeword (or binary code) of “no_residual_data_flag”and/or “no_residual_syntax_flag”.

Referring to the example of Table 13, the context index offset value of0 may be applied to the syntax element “no_residual_data_flag” and/or“no_residual_syntax_flag” regardless of the slice type. Accordingly, thesame context may be applied to the same bins in Table 13. However, thisis only an example, and the offset values in Table 13 may be set to bedifferent from the values shown in Table 13 so as to indicate suitablecontexts, and may have different values depending on the slice type.

In Example t, a predetermined fixed context may be applied to bin index0 of the syntax element “no_residual_data_flag” and/or“no_residual_syntax_flag”. Here, a predetermined fixed context index (X)may be applied to bin index 0. Here, X may be a fixed value such as 0or 1. In Example u, the bypass coding instead of contexts may be appliedto bin index 0 of the syntax element “no_residual_data_flag” and/or“no_residual_syntax_flag”.

Table 13 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 13 may beset to be different from the values shown in Table 13 so as to indicatesuitable contexts.

On the other hand, in the example of Table 13, the offsets and thecontext indices are indicated using a single context table, but theinvention is not limited to this example. For example, the context indexoffset values determined depending on the slice type and the contextindex values determined depending on the bin indices may be indicatedusing individual tables.

Table 14 schematically shows an example of a context table in whichcontext indices are allocated when the offset and the context index of asyntax element no_residual_syntax_flag are indicated using individualtables.

TABLE 14 bin index (binIdx) syntax element 0 1 2 3 4 >=5no_residual_syntax_flag 0 na na na na na

In the example of Table 14, the context indices may be indicated by binindices (binIdx). As described above, the context index increment isreferred to as a context index for the purpose of convenience ofexplanation, and the context indices allocated to the bin indices in theexample of Table 14 may actually mean context index increments.Accordingly, in the example of Table 14, the actual context indices ofthe bins constituting the codeword (or binary code) of the syntaxelement no_residual_syntax_flag may be determined by the sum of theoffset (ctxIdxOffset) determined depending on the slice type and thecontext indices allocated to the bin indices.

Referring to Table 14, a context index of 0 may be allocated to binindex 0 indicating the first bin constituting the codeword (or binarycode) of the syntax element no_residual_syntax_flag. NA (not available)may be allocated to the bin indices having a value of 1 or greater.

Table 14 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 14 may beset to be different from the values shown in Table 14 so as to indicatesuitable contexts.

Table 15 shows an example of a context table that can be applied to asyntax element “cbf_luma”. In the context table according to the exampleof Table 15, the offsets and/or the context indices may be set. Thecontexts to be applied to the bins constituting the codeword (or binarycode) of the syntax element “cbf_luma” may be indicated by the sum ofthe offsets and the context indices.

TABLE 15 context index by bin slice type offset 0 I 0 (trafoDepth==0) ||(log2TrafoSize ==Log2MaxTrafoSize) ? 1:0 P 2 (trafoDepth==0) ||(log2TrafoSize ==Log2MaxTrafoSize) ? 1:0 B 4 (trafoDepth==0) ||(log2TrafoSize ==Log2MaxTrafoSize) ? 1:0

As described above, the syntax element “cbf_luma” may indicate whetherthe transform block of a luma component to which the syntax element isapplied includes a transform coefficient other than 0. Since “cbf_luma”indicates one of two values, a context index may be allocated to the binindex (binIdx) value of 0 in the codeword (or binary code) of“cbf_luma”.

In the example of Table 15, different offset values may be set dependingon the slice type. For example, the context index offset value ofcbf_luma may be set to 0 in the I slice, the context index offset valueof cbf_luma may be set to 2 in the P slice, and the context index offsetvalue of cbf_luma may be set to 4 in the B slice. Accordingly, in theexample of Table 15, different contexts may be allocated by conditionsby applying different offsets depending on the state information or thecondition.

However, this is only an example, and the offset values in Table 15 maybe set to be different from the values shown in Table 15 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset value of cbf_lumamay be set to 0 in the I slice, the context index offset value ofcbf_luma may be set to 4 in the P slice, and the context index offsetvalue of cbf_luma may be set to 2 in the B slice. Alternatively, acommon offset value may be applied to all the slice types.

On the other hand, as described above, the context index may differdepending on the environment (state or condition) in which the syntaxelement is applied. For example, as for the same bin (or bin index),different contexts may be applied to the bins at the same position inthe codeword (or binary code) depending on the state or condition suchas the depth or the size of a block in which the syntax element isapplied. In the example of Table 15, a context may be applied to binindex 0 of cbf_luma on the basis of the partition depth (for example,trafoDepth) of a current transform unit, the size of the currenttransform unit (for example, the size of the current transform unit maybe indicated by log 2TrafoSize), and the largest transform size (forexample, the largest transform may be indicated by log 2MaxTrafoSize)allowable in a current sequence. Here, the current transform unit maymean a transform unit to which the syntax element cbf_luma is applied.

Referring to Table 15, when the depth value (trafoDepth) of thetransform unit to which the syntax element cbf_luma will be applied is0, a context index of 1 may be allocated to bin index 0 of cbf_luma.When the depth value (trafoDepth) of the transform unit to which thesyntax element cbf_luma will be applied is not 0, the context index tobe allocated to bin index 0 may be determined depending on therelationship between the size of the current transform unit and thelargest transform size. For example, a context index of 1 may beallocated to bin index 0 when the size (log 2TrafoSize) of the currenttransform unit and the largest transform size (log 2MaxTrafoSize) areequal to each other, and a context index of 0 may be allocated to binindex when the size (log 2TrafoSize) of the current transform unit andthe largest transform size (log 2MaxTrafoSize) are not equal to eachother

That is, in the example of Table 15, when the depth value (trafoDepth)of the transform unit is 0 or when the size (log 2TrafoSize) of thecurrent transform unit and the largest transform size (log2MaxTrafoSize) are equal to each other, a context index of 1 may beallocated to bin index 0. Otherwise, a context index of 0 may beallocated to bin index 0.

Table 16 shows another example of a context table that can be applied toa syntax element “cbf_luma”. With the context table according to theexample of Table 16, the offsets and/or the context indices may beassigned. The contexts to be applied to the bins constituting thecodeword (or binary code) of the syntax element “cbf_luma” may beindicated by the sum of the offsets and the context indices.

TABLE 16 context index by bin slice type offset 0 I 0 (trafoDepth==0) ?1: 0 P 2 (trafoDepth==0) ? 1: 0 B 4 (trafoDepth==0) ? 1: 0

In the example of Table 16, different offset values may be set dependingon the slice type. For example, the context index offset value ofcbf_luma may be set to 0 in the I slice, the context index offset valueof cbf_luma may be set to 2 in the P slice, and the context index offsetvalue of cbf_luma may be set to 4 in the B slice. Accordingly, in theexample of Table 16, different contexts may be allocated by conditionsby applying different offsets depending on the state information or thecondition.

However, this is only an example, and the offset values in Table 16 maybe set to be different from the values shown in Table 16 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset value of cbf_lumamay be set to 0 in the I slice, the context index offset value ofcbf_luma may be set to 4 in the P slice, and the context index offsetvalue of cbf_luma may be set to 2 in the B slice. Alternatively, acommon offset value may be applied to all the slice types.

On the other hand, in the example of Table 15, when the depth value(trafoDepth) of the current transform unit is not 0 and the size (log2TrafoSize) of the current transform unit and the largest transform size(log 2MaxTrafoSize) are equal to each other, a context index of 1 may beallocated to bin index 0. However, when the occurrence frequency inwhich the depth value (trafoDepth) of the current transform unit is not0 and the size (log 2TrafoSize) of the current transform unit and thelargest transform size (log 2MaxTrafoSize) are equal to each other issmall, the process of comparing the size (log 2TrafoSize) of the currenttransform unit and the largest transform size (log 2MaxTrafoSize) maycause an increase in complexity in the course of driving contexts.

Accordingly, in order to prevent this problem, the process of derivingthe context for bin index 0 of cbf_luma may be simplified by applyingthe context using only the depth value (trafoDepth) of the currenttransform unit. In the example of Table 16, the context index for binindex 0 of cbf_luma may be determined on the basis of the partitiondepth (for example, trafoDepth) of the current transform unit.

Referring to Table 16, when the depth value (trafoDepth) of thetransform unit to which the syntax element cbf_luma will be applied is0, a context index of 1 may be allocated to bin index 0 of cbf_luma.When the depth value (trafoDepth) of the transform unit to which thesyntax element cbf_luma will be applied is not 0, a context index of 0may be allocated to bin index 0 of cbf_luma.

The example of Table 16 may be considered to be an example where whenthe depth value (trafoDepth) of the current transform unit is not 0, acontext index of 0 is allocated to bin index 0 regardless of whether thesize (log 2TrafoSize) of the current transform unit and the largesttransform size (log 2MaxTrafoSize) are equal to each other. That is, ifthe example of Table 15 is changed to an example where when the depthvalue (trafoDepth) of the current transform unit is not 0, a contextindex of 0 is allocated to bin index 0 regardless of whether the size(log 2TrafoSize) of the current transform unit and the largest transformsize (log 2MaxTrafoSize) are equal to each other, the changed examplemay be considered to be equal to the example of Table 16.

On the other hand, in the example of Table 16, the offsets and thecontext indices are indicated using a single context table, but theinvention is not limited to this example. For example, the context indexoffset values determined depending on the slice type and the contextindex values determined depending on the bin indices may be indicatedusing individual tables.

Table 16 schematically shows an example of a context table in which theoffsets are allocated when the offset and the context index of a syntaxelement cbf_luma are indicated using individual tables.

TABLE 17 binarization syntax element initType type maxBinIdxCtxctxIdxTable ctxIdxOffset cbf_luma 0 FL, cMax=1 0 Table 9-23 0 1 0 Table9-23 2 2 0 Table 9-23 4

In the example of Table 17, the context index offset “ctxIdxOffset” maybe determined depending on “initType”. Here, initType may correspond tothe initial value determined depending on the slice type. For example,the value of initType for the I slice may be 0, the value of initTypefor the P slice may be 1, and the value of initType for the B slice maybe 2. Alternatively, the value of initType for the I slice may be 0, thevalue of initType for the P slice may be 2, and the value of initTypefor the B slice may be 1.

The context index offset value may be determined depending on the valueof initType. Accordingly, the context index offset value may beconsidered to be determined depending on the slice type. For example,the offset value for the I slice may be 0, the offset value for the Pslice may be 2, and the offset value for the B slice may be 4.Alternatively, the offset value for the I slice may be 0, the offsetvalue for the P slice may be 4, and the offset value for the B slice maybe 2.

In Table 17, FL may mean fixed-length binarization. That is, thebinarization type applied to the syntax element cbf_luma may correspondto the fixed-length binarization. “cMax” may mean a parameter used forthe fixed-length binarization.

In the example of Table 17, the maximum value (maxBinIdxCtx) of the binindices of the syntax element cbf_luma may be set or determined to be 0.The context (or probability parameter) to be applied to a specific binof the syntax element cbf_luma may be determined using a table (forexample, “Table 9-23”) indicated by the context index table index(ctxIdxTable).

Table 18 schematically shows an example of a context table in which thecontext indices are allocated when the offset and the context index of asyntax element cbf_luma are indicated using individual tables.

TABLE 18 syntax bin index (binIdx) element 0 1 2 3 4 >=5 cbf_lumatrafoDepth==0 ? 1 : 0 na na na na na

In the example of Table 18, the context indices may be indicated by binindices (binIdx).

As described above, the context index may differ depending on theenvironment (state or condition) in which the syntax element is applied.For example, as for the same bin (or bin index), different contexts maybe applied to the bins at the same position in the codeword (or binarycode) depending on the state or condition such as the depth or the sizeof a block in which the syntax element is applied.

In the example of Table 18, a context index may be determined for binindex 0 of cbf_luma on the basis of the partition depth (for example,trafoDepth) of the current transform unit.

Referring to Table 18, when the depth value (trafoDepth) of thetransform unit to which the syntax element cbf_luma will be applied is0, a context index of 1 may be allocated to bin index 0 of cbf_luma.When the depth value (trafoDepth) of the transform unit to which thesyntax element cbf_luma will be applied is not 0, a context index of 0may be allocated to bin index 0 of cbf_luma. No context index may beallocated to the bin indices having a value of 1 or greater or NA (notavailable) may be allocated thereto.

Table 18 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 18 may beset to be different from the values shown in Table 18.

Table 19 shows still another example of a context table that can beapplied to a syntax element “cbf_luma”. In the context table accordingto the example of Table 19, the offsets and/or the context indices maybe set. The contexts to be applied to the bins constituting the codeword(or binary code) of the syntax element “cbf_luma” may be indicated bythe sum of the offsets and the context indices.

TABLE 19 context index by bin slice type offset 0 I 0 X P 1 X B 2 X

In the example of Table 19, different offset values may be set dependingon the slice type. For example, the context index offset value ofcbf_luma may be set to 0 in the I slice, the context index offset valueof cbf_luma may be set to 1 in the P slice, and the context index offsetvalue of cbf_luma may be set to 2 in the B slice. Accordingly, in theexample of Table 19, different contexts may be allocated by conditionsby applying different offsets depending on the state information or thecondition.

However, this is only an example, and the offset values in Table 19 maybe set to be different from the values shown in Table 19 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset value of cbf_lumamay be set to 0 in the I slice, the context index offset value ofcbf_luma may be set to 2 in the P slice, and the context index offsetvalue of cbf_luma may be set to 1 in the B slice. Alternatively, acommon offset value may be applied to all the slice types.

In the example of Table 19, a predetermined fixed context may be appliedto bin index 0 indicating the first bin constituting the codeword (orbinary code) of the syntax element cbf_luma. Here, a predetermined fixedcontext index (X) may be applied to bin index 0. Here, X may be a fixedvalue such as 0 or 1.

Table 19 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 19 may beset to be different from the values shown in Table 19 so as to indicatesuitable contexts.

Table 20 shows still another example of a context table that can beapplied to a syntax element “cbf_luma”. In the context table accordingto the example of Table 20, the offsets, the context indices, and theinformation on whether to apply the bypass mode may be set.

TABLE 20 context index by bin slice type offset 0 I 0 bypass P 1 bypassB 2 bypass

In the example of Table 20, different offset values may be set dependingon the slice type. For example, the context index offset value ofcbf_luma may be set to 0 in the I slice, the context index offset valueof cbf_luma may be set to 1 in the P slice, and the context index offsetvalue of cbf_luma may be set to 2 in the B slice. Accordingly, in theexample of Table 20, different contexts may be allocated by conditionsby applying different offsets depending on the state information or thecondition.

However, this is only an example, and the offset values in Table 20 maybe set to be different from the values shown in Table 20 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset value of cbf_lumamay be set to 0 in the I slice, the context index offset value ofcbf_luma may be set to 2 in the P slice, and the context index offsetvalue of cbf_luma may be set to 1 in the B slice. Alternatively, acommon offset value may be applied to all the slice types.

In the example of Table 20, instead of the context, the bypass codingmay be applied to bin index 0 indicating the first bin constituting thecodeword (or binary code) of the syntax element cbf_luma. Here, apredetermined fixed context index (X) may be applied to bin index 0.Here, X may be a fixed value such as 0 or 1.

In the examples of Tables 15 to 20, the context index increment isreferred to as a context index for the purpose of convenience ofexplanation, and the context indices allocated to the bin indices in theexamples of Tables 15 to 20 may actually mean context index increments(ctxIdxInc). Accordingly, in the examples of Tables 15 to 20, the actualcontext indices of the bins constituting the codeword (or binary code)of the syntax element cbf_luma may be determined by the sum of theoffset (ctxIdxOffset) determined depending on the slice type and thecontext indices allocated to the bin indices.

Table 21 shows an example of a context table that can be applied tosyntax elements “cbf_cb” and “cbf_cr”. In the context table according tothe example of Table 21, the offsets and/or the context indices may beset. The contexts to be applied to the bins constituting the codeword(or binary code) of the syntax elements “cbf_cb” and “cbf_cr” may beindicated or expressed by the sum of the offsets and the contextindices.

TABLE 21 context index by bin slice type offset 0 I 0 trafoDepth P 4trafoDepth B 8 trafoDepth

As described above, the syntax elements cbf_cb and cbf_cr may indicatewhether the transform block of chroma components to which the syntaxelement is applied includes a transform coefficient other than 0. Thatis, cbf_cb and cbf_cr may indicate whether residual information ispresent for the chroma components of the transform block to which thecorresponding syntax element is applied. Since cbf_cb and cbf_crindicates one of two values, a context index may be allocated to the binindex (binIdx) value of 0 in the codeword (or binary code) of cbf_cb andcbf_cr.

In the example of Table 21, different offset values may be set dependingon the slice type. For example, the context indices offset values ofcbf_cb and cbf_cr may be set to 0 in the I slice, the context indicesoffset values of cbf_cb and cbf_cr may be set to 4 in the P slice, andthe context indices offset values of cbf_cb and cbf_cr may be set to 8in the B slice. Accordingly, in the example of Table 21, differentcontexts may be allocated by conditions by applying different offsetsdepending on the state information or the condition.

However, this is only an example, and the offset values in Table 21 maybe set to be different from the values shown in Table 21 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset values of cbf_cband cbf_cr may be set to 0 in the I slice, the context index offsetvalues of cbf_cb and cbf_cr may be set to 8 in the P slice, and thecontext index offset values of cbf_cb and cbf_cr may be set to 4 in theB slice. Alternatively, a common offset value may be applied to all theslice types.

On the other hand, as described above, the context index may differdepending on the environment (state or condition) in which the syntaxelement is applied. For example, as for the same bin (or bin index),different contexts may be applied to the bins at the same position inthe codeword (or binary code) depending on the state or condition suchas the depth or the size of a block in which the syntax element isapplied.

In the example of Table 21, the partition depth (trafoDepth) of acurrent transform unit to which the corresponding syntax element isapplied may be applied or utilized as the context index to bin index 0of cbf_cb and cbf_cr.

On the other hand, in the example of Table 21, the offsets and thecontext indices are indicated using a single context table, but theinvention is not limited to this example. For example, the context indexoffset values determined depending on the slice type and the contextindex values determined depending on the bin indices may be indicatedusing individual tables.

Table 22 schematically shows an example of a context table in which theoffsets are allocated when the offset and the context indices of syntaxelements cbf_cb and cbf_cr are indicated using individual tables.

TABLE 22 binarization syntax element initType type maxBinIdxCtxctxIdxTable ctxIdxOffset cbf_cb, 0 FL, cMax=1 0 Table 9-24 0 cbf_cr 1 0Table 9-24 4 2 0 Table 9-24 8

In the example of Table 22, the context index offset “ctxIdxOffset” maybe determined depending on “initType”. Here, initType may correspond tothe initial value determined depending on the slice type. For example,the value of initType for the I slice may be 0, the value of initTypefor the P slice may be 1, and the value of initType for the B slice maybe 2. Alternatively, the value of initType for the I slice may be 0, thevalue of initType for the P slice may be 2, and the value of initTypefor the B slice may be 1.

The context index offset value may be determined depending on the valueof initType. Accordingly, the context index offset value may beconsidered to be determined depending on the slice type. For example,the offset value for the I slice may be 0, the offset value for the Pslice may be 4, and the offset value for the B slice may be 8.Alternatively, the offset value for the I slice may be 0, the offsetvalue for the P slice may be 8, and the offset value for the B slice maybe 4.

In Table 22, FL may mean fixed-length binarization. That is, thebinarization type applied to the syntax elements cbf_cb and cbf_cr maycorrespond to the fixed-length binarization. “cMax” may mean a parameterused for the fixed-length binarization.

In the example of Table 22, the maximum value (maxBinIdxCtx) of the binindices of the syntax elements cbf_cb and cbf_cr may be set ordetermined to be 0. The context (or probability parameter) to be appliedto a specific bin of the syntax elements cbf_cb and cbf_cr may bedetermined using a table (for example, “Table 9-24”) indicated by thecontext index table index (ctxIdxTable).

Table 23 schematically shows an example of a context table in which thecontext indices are allocated when the offsets and the context indicesof syntax elements cbf_cb and cbf_cr are indicated using individualtables.

TABLE 23 syntax bin index (binIdx) element 0 1 2 3 4 >=5 cbf_cb,trafoDepth na na na na na cbf_cr

In the example of Table 23, the context indices may be indicated by binindices (binIdx).

As described above, the context index may differ depending on theenvironment (state or condition) in which the syntax element is applied.For example, as for the same bin (or bin index), different contexts maybe applied to the bins at the same position in the codeword (or binarycode) depending on the state or condition such as the depth or the sizeof a block in which the syntax element is applied.

In the example of Table 23, a context index may be determined for binindex 0 of cbf_cb and cbf_cr on the basis of the partition depth (forexample, trafoDepth) of the current transform unit.

Referring to Table 23, the depth value (trafoDepth) of the a transformunit (TU) to which the syntax element will be applied may be applied orutilized as a context index to bin index 0 of the syntax elements cbf_cband cbf_cr. No context index may be allocated to the bin indices havinga value of 1 or greater or NA (not available) may be allocated thereto.

Table 23 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 23 may beset to be different from the values shown in Table 23.

Table 24 shows still another example of a context table that can beapplied to syntax elements “cbf_cb and cbf_cr”. In the context tableaccording to the example of Table 24, the offsets and/or the contextindices may be set. The contexts to be applied to the bins constitutingthe codeword (or binary code) of the syntax elements “cbf_cb and cbf_cr”may be indicated by the sum of the offsets and the context indices.

TABLE 24 context index by bin slice type offset 0 I 0 X P 1 X B 2 X

In the example of Table 24, different offset values may be set dependingon the slice type. For example, the context index offset values ofcbf_cb and cbf_cr may be set to 0 in the I slice, the context indexoffset values of cbf_cb and cbf_cr may be set to 1 in the P slice, andthe context index offset values of cbf_cb and cbf_cr may be set to 2 inthe B slice. Accordingly, in the example of Table 24, different contextsmay be allocated by conditions by applying different offsets dependingon the state information or the condition.

However, this is only an example, and the offset values in Table 24 maybe set to be different from the values shown in Table 24 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset values of cbf_cband cbf_cr may be set to 0 in the I slice, the context index offsetvalues of cbf_cb and cbf_cr may be set to 2 in the P slice, and thecontext index offset values of cbf_cb and cbf_cr may be set to 1 in theB slice. Alternatively, a common offset value may be applied to all theslice types.

In the example of Table 24, a predetermined fixed context may be appliedto bin index 0 indicating the first bin constituting the codeword (orbinary code) of the syntax elements cbf_cb and cbf_cr. Here, apredetermined fixed context index (X) may be applied to bin index 0.Here, X may be a fixed value such as 0 or 1.

Table 24 shows an example where the context index values by bins arespecifically set. The context index values by bins in Table 24 may beset to be different from the values shown in Table 24 so as to indicatesuitable contexts.

Table 25 shows still another example of a context table that can beapplied to syntax elements “cbf_cb and cbf_cr”. In the context tableaccording to the example of Table 20, the offsets, the context indices,and the information on whether to apply the bypass mode may be set.

TABLE 25 context index by bin slice type offset 0 I 0 bypass P 1 bypassB 2 bypass

In the example of Table 25, different offset values may be set dependingon the slice type. For example, the context index offset values ofcbf_cb and cbf_cr may be set to 0 in the I slice, the context indexoffset values of cbf_cb and cbf_cr may be set to 1 in the P slice, andthe context index offset values of cbf_cb and cbf_cr may be set to 2 inthe B slice. Accordingly, in the example of Table 25, different contextsmay be allocated by conditions by applying different offsets dependingon the state information or the condition.

However, this is only an example, and the offset values in Table 25 maybe set to be different from the values shown in Table 25 so as toindicate suitable contexts, and may have different values depending onthe slice type. For example, the context index offset values of cbf_cband cbf_cr may be set to 0 in the I slice, the context index offsetvalues of cbf_cb and cbf_cr may be set to 2 in the P slice, and thecontext index offset values of cbf_cb and cbf_cr may be set to 1 in theB slice. Alternatively, a common offset value may be applied to all theslice types.

In the example of Table 25, instead of the context, the bypass codingmay be applied to bin index 0 indicating the first bin constituting thecodeword (or binary code) of the syntax elements cbf_cb and cbf_cr.Here, a predetermined fixed context index (X) may be applied to binindex 0. Here, X may be a fixed value such as 0 or 1.

In the examples of Tables 21 to 25, the context index increment isreferred to as a context index for the purpose of convenience ofexplanation, and the context indices allocated to the bin indices in theexamples of Tables 21 to 25 may actually mean context index increments(ctxIdxInc). Accordingly, in the examples of Tables 21 to 25, the actualcontext indices of the bins constituting the codeword (or binary code)of the syntax elements cbf_cb and cbf_cr may be determined by the sum ofthe offset (ctxIdxOffset) determined depending on the slice type and thecontext indices allocated to the bin indices.

On the other hand, in the above-mentioned embodiments, offset valuesdifferent depending on the slice types may be applied or an offset valuecommon to all the slice types may be applied. When the offset valuesdifferent depending on the slice types are applied to a specific syntaxelement, different contexts may be applied to the same bin indexdepending on whether the slice is an I slice, a P slice, or a B slice.When the offset value common to all the slice types is applied, acontext (or a context set) common to all the slice types may be applied.

However, the above-mentioned embodiments are only exemplary and theinvention is not limited to the embodiments. The offset values may beset in a way other than in the above-mentioned embodiments.

For example, different contexts (or different context sets) may beapplied to the same bin in a specific syntax element depending onwhether a current slice is an intra slice or an inter slice. Here, theintra slice may mean an I slice, and the inter slice may include a Pslice and a B slice. That is, the intra slice and the inter slice may bedistinguished, different offset values may be applied to the intra sliceand the inter slice, and a common offset value may be applied to the Pslice and the B slice which are included in the inter slice.

While the methods in the above-mentioned embodiments have been describedon the basis of the flowcharts as a series of steps or blocks, theinvention is not limited to the order of the steps and a certain stepmay be performed in an order other than described above or at the sametime as described above. The above-mentioned embodiments include variousexamples. Therefore, the invention includes all substitutions,corrections, and modifications belonging to the appended claims.

When it is mentioned above that an element is “connected to” or “coupledto” another element, it should be understood that still another elementmay be interposed therebetween, as well as that the element may beconnected or coupled directly to another element. On the contrary, whenit is mentioned that an element is “connected directly to” or “coupleddirectly to” another element, it should be understood that still anotherelement is not interposed therebetween.

1-20. (canceled)
 21. An entropy decoding method, by a decodingapparatus, comprising: deriving a current luma transform block from acurrent coding block; deriving context information on a bin constitutinga codeword of a syntax element cbf_luma that specifies whether a lumaresidual other than 0 is present in a current luma transform block;performing an arithmetic decoding on the bin based on the derivedcontext information; and deriving a value of the syntax element cbf_lumabased on the decoded bin, wherein the step of deriving the contextinformation includes deriving the context information based oninformation on a transform depth (trafoDepth) of the current lumatransform block, wherein a luma residual other than 0 is not present inthe current luma transform block when the derived value of the syntaxelement cbf_luma is 0, and wherein at least one luma residual other than0 is present in the current luma transform block when the derived valueof the syntax element cbf_luma is
 1. 22. The entropy decoding methodaccording to claim 21, wherein the context information in the step ofderiving the context information on the bin is indicated by the sum of acontext index offset and a context value for the bin, and wherein thecontext index offset is determined depending on whether a current sliceis an I slice, a P slice, or a B slice.
 23. The entropy decoding methodaccording to claim 22, wherein the value of the context index offset is0 when the current slice is an I slice, is 2 when the current slice is aP slice, and is 4 when the current slice is a B slice.
 24. The entropydecoding method according to claim 22, wherein in the step of derivingthe context information on the bin, the bin is a first bin of thecodeword to which a bin index having a value of 0 is allocated, and avalue of 1 is allocated to the context value for the bin when thetransform depth of the current luma transform block is
 0. 25. Theentropy decoding method according to claim 22, wherein in the step ofderiving the context information on the bin, the bin is a first bin ofthe codeword to which a bin index having a value of 0 is allocated, anda value of 0 is allocated to the context value for the bin when thetransform depth of the current luma transform block is not
 0. 26. Theentropy decoding method according to claim 22, wherein in the step ofderiving the context information on the bin, the bin is a first bin ofthe codeword to which a bin index having a value of 0 is allocated, acontext value of 1 is allocated to the bin when the transform depth ofthe current luma transform block is not 0 and the size of the transformblock is equal to a maximum transform size of a current sequence, and acontext index of 0 is allocated to the bin when the size of the currentluma transform block is not equal to the maximum transform size.
 27. Theentropy decoding method according to claim 21, wherein the contextinformation is specified by the sum of a context index offset determinedon the basis of a slice type of a current slice and a context value bythe bin, wherein the value of a bin index indicating the bin in thesyntax element cbf_luma is 0, and wherein the value of the context indexoffset is 0 when the current slice is an I slice, is 2 when the currentslice is a P slice, and is 4 when the current slice is a B slice. 28.The entropy decoding method according to claim 27, wherein in the stepof deriving the context information on the bin, the bin is a first binof the codeword to which a bin index having a value of 0 is allocated, avalue of 1 is allocated to the context value for the bin when thetransform depth of the current luma transform block is 0, and a value of0 is allocated to the context value for the bin when the transform depthof the current luma transform block is not
 0. 29. The entropy decodingmethod according to claim 27, wherein in the step of deriving thecontext information on the bin, the bin is a first bin of the codewordto which a bin index having a value of 0 is allocated, a value of 1 isallocated to the context value for the bin when t the transform depth ofthe current luma transform block is 0, and a value of 1 is allocated tothe context value for the bin when the transform depth of the currentluma transform block is not 0 and the size of the current luma transformblock is equal to a maximum transform size of a current sequence, and avalue of 0 is allocated to the context value for the bin when the sizeof the current luma transform block is not equal to the maximumtransform size.
 30. The entropy decoding method according to claim 21,wherein the current luma transform block contains one or more transformcoefficient levels not equal to 0 when the at least one luma residualother than 0 is present in the current luma transform block.
 31. Adecoding apparatus performing an entropy decoding, comprising: anentropy decoding module for deriving a current luma transform block froma current coding block, for deriving context information on a binconstituting a codeword of a syntax element cbf_luma that specifieswhether a luma residual other than 0 is present in a current lumatransform block, for performing an arithmetic decoding on the bin basedon the derived context information, and for deriving a value of thesyntax element cbf_luma based on the decoded bin, a video reconstructingmodule for generating a reconstructed picture based on the value of thesyntax element cbf_luma wherein the entropy decoding module derives thecontext information based on information on a transform depth(trafoDepth) of the current luma transform block, wherein a lumaresidual other than 0 is not present in the current luma transform blockwhen the derived value of the syntax element cbf_luma is 0, and whereinat least one luma residual other than 0 is present in the current lumatransform block when the derived value of the syntax element cbf_lumais
 1. 32. The apparatus of claim 31, wherein the context information isindicated by the sum of a context index offset and a context value forthe bin, and wherein the context index offset is determined depending onwhether a current slice is an I slice, a P slice, or a B slice.
 33. Theapparatus of claim 32, wherein the value of the context index offset is0 when the current slice is an I slice, is 2 when the current slice is aP slice, and is 4 when the current slice is a B slice.
 34. The apparatusof claim 32, wherein the bin is a first bin of the codeword to which abin index having a value of 0 is allocated, and wherein a value of 1 isallocated to the context value for the bin when the transform depth ofthe current luma transform block is
 0. 35. The apparatus of claim 32,wherein the bin is a first bin of the codeword to which a bin indexhaving a value of 0 is allocated, and wherein a value of 0 is allocatedto the context value for the bin when the transform depth of the currentluma transform block is not
 0. 36. The apparatus of claim 32, whereinthe bin is a first bin of the codeword to which a bin index having avalue of 0 is allocated, wherein a context value of 1 is allocated tothe bin when the transform depth of the current luma transform block isnot 0 and the size of the transform block is equal to a maximumtransform size of a current sequence, and wherein a context index of 0is allocated to the bin when the size of the current luma transformblock is not equal to the maximum transform size.
 37. The apparatus ofclaim 31, wherein the context information is specified by the sum of acontext index offset determined on the basis of a slice type of acurrent slice and a context value by the bin, wherein the value of a binindex indicating the bin in the syntax element cbf_luma is 0, andwherein the value of the context index offset is 0 when the currentslice is an I slice, is 2 when the current slice is a P slice, and is 4when the current slice is a B slice.
 38. The apparatus of claim 37,wherein the bin is a first bin of the codeword to which a bin indexhaving a value of 0 is allocated, wherein a value of 1 is allocated tothe context value for the bin when the transform depth of the currentluma transform block is 0, and wherein a value of 0 is allocated to thecontext value for the bin when the transform depth of the current lumatransform block is not
 0. 39. The apparatus of claim 37, wherein the binis a first bin of the codeword to which a bin index having a value of 0is allocated, wherein a value of 1 is allocated to the context value forthe bin when t the transform depth of the current luma transform blockis 0, and wherein a value of 1 is allocated to the context value for thebin when the transform depth of the current luma transform block is not0 and the size of the current luma transform block is equal to a maximumtransform size of a current sequence, and a value of 0 is allocated tothe context value for the bin when the size of the current lumatransform block is not equal to the maximum transform size.
 40. Theapparatus of claim 31, wherein the current luma transform block containsone or more transform coefficient levels not equal to 0 when the atleast one luma residual other than 0 is present in the current lumatransform block.